Comments (5)
By default it should upload to RAM, so the code will be executed automatically. Why do you think it's not being run?
from espruinotools.
I think I experience the same issue - the script seems to be uploaded successfully, but it does not execute.
I am trying to run the LED1 blink sample
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).
(side note: the browser version cannot connect via Web Serial connection)
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 Module
The js code is pretty much as the one used by @msaigla
The output is way larger, but this is the tail of it:
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 environment
Windows 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?
I got some vulnerabilities errors / warnings when running npm i espruino
C:\Prv\Espruino\ET>npm i espruino
npm WARN deprecated [email protected]: Use your platform's native DOMException instead
added 70 packages, and audited 71 packages in 22s
5 vulnerabilities (1 moderate, 4 high)
from espruinotools.
I should also probably add that -e
does not work as well:
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).
from espruinotools.
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):
- I needed to add -b 115200 explicitly
- run espruino tools command 2 times
- press a hardware RESET on Arduino board between the uploads
Those are the steps:
1. Upload first time
c:\>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 command
c:\>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)
and also, the LED is blinking!
4. Change the program and reupload - from now on it will work
From 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!
from espruinotools.
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,
from espruinotools.
Related Issues (20)
- Upload code to flash using node module HOT 2
- Cannot find bangle.js with espruino --list HOT 7
- Error EspruinoTools and JQuery 3.6.0. HOT 9
- Error after fix for electron (0.1.42) HOT 11
- CLI attempts to access UNIX socket on Windows HOT 11
- espruino --list returns "Error: No compatible USB Bluetooth 4.0 device found!" HOT 3
- Cannot connect to puck.js on raspios/bullseye/arm64 HOT 5
- Terminal support for handling color text display with ANSI escape sequences HOT 14
- Dependency "tar.gz" is deprecated and contains security vulnerabilities HOT 1
- Use CLI with IDE Relay? HOT 2
- espruino-cli: Watch mode with file argument requires process.stdin.rawMode HOT 1
- 404 not found during `npm install espruino` HOT 1
- Work with arm64 HOT 1
- Improvements to localModules HOT 2
- Unable to install due to error in unmaintained dependency HOT 6
- Better typescript type support HOT 11
- EspruinoTools to exe HOT 3
- Pretokenization broken for at least BangleApps HOT 2
- slowWrite is automagically configured, and is not logged even with -v verbose flag and the default is true HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from espruinotools.