Load a .js file?

Posted on
  • Is it possible to save .js files to the Espruino and include the files inside another .js file?

  • You can save what you've currently got into Espruino with save() but there isn't room in the chip for other files. Instead you can save onto the SD card.

    You can save modules into node_modules/modname.js on the SD card and can load them with require('modname'), or you can simply load and execute any JS file from the SD card with: eval(require('fs').readFile("filepath.js­"))

  • Hi Gordon. Thanks for your response. I was considering purchasing a STM32 F4 Discovery board while waiting for the Espruino to become readily available. The Discovery board does not have a SD Card slot, but if I purchased a SD modular from a distributor will .readFile() work?

    One more question, do you have an estimate about when distributors will start carrying Espruino boards?

  • Hi, I'm afraid that the filesystem support won't work on the F4 boards. IMO you're best off buying one of the 3.2" HY boards - they're very good value for things that need an LCD.

    I don't yet know when the board will be available. I was really hoping it would be the end of this week, but we'll just have to see. I think Seeed will move quite quickly when they get back from CNY, but I don't know about the UK distributor.

    I may just push ahead with selling through Amazon though - it might end up being significantly less hassle.

  • I was considering the HY board, but I think the LCD will be a little over kill for my current project. I was planning on using 3 rows of 4 7segment LEDs to output my sensor data; also create a GUI with node-webkit for the computer to also output the real-time sensor data. The discovery board looked the most appealing because of its 6 uart ports. Two of my sensors use uart to communicate and the wifi(wifly) module also uses uart to communicate. Leaving 3 extra uart ports open to use in the future for possible upgrades. Since SD does not currently work for the discovery board I will opt to wait for the Espruino board to become available and use a uart multiplexer to extend the available uart ports the Espruino board provides.

    I'm located in the USA so who ever is located in the US will work ;-)

  • Yes, it might be a plan. To be fair, there are 5 UARTs on the Espruino board (all brought out to pins apart from RX on one UART) so you'll probably be fine with that :)

  • I completly overlooked the information about the Espruino board. I will wait until the Espruino becomes available.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Load a .js file?

Posted by Avatar for d0773d @d0773d