Loading local modules on Pico #5235
Replies: 1 comment
-
Posted at 2016-04-03 by d0773d For starters, have a look at: http://www.espruino.com/File+IO From the espruino docs:
Once you have wired a SD card to the appropriate pins on your Pico, tell the Pico about it, like so:
Posted at 2016-04-03 by user63585 Thanks, I'll take a look at that. I'm still a little confused as to why the SD card needs to be connected. If the modules are cached on the Pico why is the SD card needed? Posted at 2016-04-03 by Cale @user63585 It should work without the sd card. Just make sure the directory is in the right path and the module file names match. I can't remember if it loads from online or the projects folder first and have noticed when wifi connection is slow that it will throw the SD card error on me from time to time. Also you are sending from the right side to the WEB IDE? Posted at 2016-04-03 by DrAzzy I do not need an SD card to use local modules. Suspect error in the paths, naming of files, or permissions Posted at 2016-04-03 by luwar Where did you write the
Posted at 2016-04-03 by user63585 @luwar, that was it. No errors when loading it from the right side. Thanks. Posted at 2016-04-04 by @allObjects The Web IDE's upload (of the code in the Web IDE editor / pane on the right) with the Upload/send to Board Button does as first task a pattern search for all The code that runs and where it runs on upload's first step:
Part of later code is available for use in the console / left pane of Web IDE: see Modules reference, most important
(Scroll to the right if line(s) seem to be cut off.) The response in the console upon 2nd entry is: At runtime (disconnected from the IDE or entered in the console / left pane of the IDE), Espruino board and firmware is the context and looks first in its module cache for the module and second on a connected SD card. Latter allows to dynamically - at runtime - load modules into module cache (and unload from module cache) modules as needed to overcome eventual memory (RAM) constraints. If you use Now you may conclude that you can send module code to the board in the console with But what you can do is send your code directly to Espruino in the console by (copying and) pasting the source there. It is not the most convenient way but it works, as we partially shown above, and will show here again (with a slightly different sample code ...Scroll to the right if line(s) seem to be cut off.*)
This creates a Switch-module and a Switch on any pin you connect to. In latter entry, it creates a switch on the red LED (LED1), turns it on for a second, then off. If you (are quick enough to) enter The *PS: Code partially verified. Will complete verification when back in 'lab'. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2016-04-03 by user63585
Hi,
I'm trying to load a local module in the Pico. I have setup the sandbox and copied my module to the modules folder. When I use require('module') i get the following error:
ERROR: SD card must be setup with E.connectSDCard first
Then the module is not found and more error occur. Any clue what I am doing wrong?
Thanks,
Mike
Beta Was this translation helpful? Give feedback.
All reactions