New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Play program #163
Comments
By default it should upload to RAM, so the code will be executed automatically. Why do you think it's not being run? |
I think I experience the same issue - the script seems to be uploaded successfully, but it does not execute. var on = false;
setInterval(function() {
on = !on;
LED1.write(on);
}, 500); and it does work when uploaded via Espruino IDE (Native) (the led is blinking). Then I try to do the same with espruino tools or with espruino npm module, and despite I see no error, the led is not blinking. Espruino tools:C:\>espruino -p COM3 --board ESP32 "C:\blinkLed1.js"
Espruino Command-line Tool 0.1.55
-----------------------------------
Explicit board JSON supplied: "ESP32"
Connecting to 'COM3'
Connected
Upload Complete
C:\Prv\Espruino\EspruinoTools> Espruino NPM ModuleThe js code is pretty much as the one used by @msaigla Already initialised.
Noble: getPorts - disabled
Connected Ok
Got ""
No Prompt found, got undefined - issuing Ctrl-C to try and break out
Splitting for Ctrl-C, delay 250
Still no prompt - issuing another Ctrl-C
Splitting for Ctrl-C, delay 250
Sending...
---> "\u0010print(\"<\",\"<<\",JSON.stringify(process.env),\">>\",\">\")\n"
Sent
Receiving...
No result found for "process.env" - just got ""
Unable to retrieve board information.
Connection Error?
Minifying
Minification complete
Got ""
No Prompt found, got undefined - issuing Ctrl-C to try and break out
Splitting for Ctrl-C, delay 250
Still no prompt - issuing another Ctrl-C
Splitting for Ctrl-C, delay 250
Sending...
---> "\u0010reset();\n\u0010print()\n\u0010setTime(1714853595.315);E.setTimeZone(2)\n\u0010var on = false;\n\u0010setInterval(function() {\u001b\n on = !on;\u001b\n LED1.write(on);\u001b\n}, 500);\n\n"
Splitting for reset(), delay 250
Sent
Done! My environmentWindows 10 C:\>node --version
v16.15.0
C:\>npm --version
8.8.0 BTW. Which version of node/npm is know to be best compatible? C:\Prv\Espruino\ET>npm i espruino
npm WARN deprecated domexception@1.0.1: Use your platform's native DOMException instead
added 70 packages, and audited 71 packages in 22s
5 vulnerabilities (1 moderate, 4 high) |
I should also probably add that C:\>espruino -p COM3 --board ESP32 -e "digitalWrite(LED1,1)"
Espruino Command-line Tool 0.1.55
-----------------------------------
Explicit board JSON supplied: "ESP32"
Connecting to 'COM3'
Connected
Upload Complete but again, it does work when uploaded via Espruino IDE (Native) (the led is ON). |
Many hours later... I think I found a workaround. Few factors are required (if I omit at least one of them, those steps won't succeed):
Those are the steps: 1. Upload first timec:\>espruino c:\blinkLed1.js --board ESP32 -p COM3 -b 115200
Espruino Command-line Tool 0.1.55
-----------------------------------
Explicit board JSON supplied: "ESP32"
Connecting to 'COM3'
Connected
Upload Complete At this point nothing happpened just yet (the script did not run - Led is not blinking) 2. Press hardware RESET button (on my ESP32 this is EN button)3, Upload second time - with the very exact commandc:\>espruino c:\blinkLed1.js --board ESP32 -p COM3 -b 115200
Espruino Command-line Tool 0.1.55
-----------------------------------
Explicit board JSON supplied: "ESP32"
Connecting to 'COM3'
Connected
--]
--] ____ _
--] | __|___ ___ ___ _ _|_|___ ___
--] | __|_ -| . | _| | | | | . |
--] |____|___| _|_| |___|_|_|_|___|
--] |_| espruino.com
--] 2v21 (c) 2023 G.Williams
--]
--] Espruino is Open Source. Our work is supported
--] only by sales of official boards and donations:
--] http://espruino.com/Donate
--]
--] >
Upload Complete Note, that the otuput differs now (Espruino logo is shown) 4. Change the program and reupload - from now on it will workFrom now on, I can change the blinkLed1.js file, then upload with the very same command from above and the new code will execute just fine! |
Glad you got it sorted! I think as you found the main issue is the baud rate. It's probably why Web Serial didn't work for you either (there's a setting in the Web IDE that you can set). The reason is that official Espruino boards use 9600 baud, but the folks working on the ESP8266/32 ports decided not to do the same and to use 115200 instead - so now all ESP32 users have to remember to change baud rate each time. Probably the second run of the tools was needed because when running without the baud rate set, some corrupt data would have been sent to the board, and that needed 'flushing out' before the upload would work, |
How can I run the program after downloading it to the controller?
In node.js
var esp = require("espruino"); esp.init(function() { Espruino.Config.RESET_BEFORE_SEND=true; esp.sendFile("COM10", ".\\UploadFile\\UploadFileJS.js", function() { console.log('Done!'); }) });
The text was updated successfully, but these errors were encountered: