-
-
-
Which web-ide you use? There is (at least) the in-browser version at https://www.espruino.com/ide/ You need to enable web-serial, and that requires a recent chrome-based browser (for example Edge and Vivaldi does work)
There is the Chrome web app https://chrome.google.com/webstore/detail/espruino-web-ide/bleoifhkdalbjfbobjackfdifdneehpo (should work without any extra steps)
And there is the native NWJS based app (that should also work without extra steps)
-
Because there is no more space :)
The VL Discovery has only 128k flash, and there is some space reserved for saving code, so the board can run code standalone.You can compare the board files, for example PICO vs VL Discovery. That Discovery board only includes
neopixel
, and hasSAVE_ON_FLASH
- removing bunch of features. While the PICO has USB, networking, graphics, encryption etc libraries built-in. -
-
You won't be able to catch that exception, since it's called in a setTimeout
But you can take a look at the code, and that exception is thrown when reading the VERSION register returns 0 or 255, most likely a communication / wiring error / the radio not present or not powered. https://github.com/espruino/EspruinoDocs/blob/master/devices/SX127x.js#L337 -
In #34 Smartibot is mentioned https://hackspace.raspberrypi.org/issues/34
Their blimp demo video is pretty cool: https://thecraftyrobot.net/blogs/projects/making-a-blimp-that-actually-flies And taking a look at their site again: The newer demos look fun too! -
Short answer: Yes, you can save code on it, and that will run at startup. Details at http://www.espruino.com/Saving
-
Hi, that's a though question, as I started a long time ago. But still find MDN docs as a great source / reference. The search is really useful, and there is a JS basics section on their site. As far as I have seen most new JS content focuses on a particular framework...
Also for trying out any random snippet of JS code, you can use just any browser console on just any computer.
And you can run Espruino interpreter in Linux, if you build it yourself, so you can experiment with code without an actual device -
Wait a moment, IIRC ESP32/8266 connect to Wifi automatically, if wifi credentials were saved. And IIRC
reset()
will not disconnect from wifi, just resets Espruino interpreter. So yes, yourwifi.on('connected'
will not fire, because it's already connected to wifi by the time your code is executed.
So what I did is check in my startup code if it's connected to wifi. If not, than start connecting. If already connected, just run wifi releated startup code immediately. -
-
Hi & welcome!
1:
Simplest would be a voltage divider. You need two resistors, just google it, should be pretty straight forward. But this only measures the voltage.If you want to measure current consumption as well, get an INA219, INA226 module from ebay / aliex.
2: Yes, 3.3V max!
3: Well, there are all kinds of starter kits, can't recommend one. Cheapest would probably be ebay / aliexpress. I guess also depends on where are you and what you want to do. Sensors? Actuators? LEDs? Analog stuff? Radio? Tons of options :)
-
Yepp, JS if full of interesting things, some help:
https://developer.mozilla.org/en-US/docs/Glossary/Truthy
https://developer.mozilla.org/en-US/docs/Glossary/FalsyBtw
!! 0 > false !! "0" > true
Obligatory talk/video: https://www.destroyallsoftware.com/talks/wat
-
Almost there, but this blows up of the len is smaller than the length of the string without padding. A small modification solves it (
(len-sbl>0)
):var len = 6; var sb = parseInt(1023).toString(2); var sbl = sb.length; var sbFixedLenStart = ('0').repeat((len-sbl>0)?(len-sbl):0) + sb; var sbFixedLenEnd = sb + ('0').repeat((len-sbl>0)?(len-sbl):0); console.log(sbFixedLenStart); console.log(sbFixedLenEnd);
MDN usually has polyfills or in this case, a link to polyfills: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart
Altho might need some tweaks to better fit Espruino's constraints... -
You can use a simple http post to send data to your backend. And from that point it's just like any data, you can do anything. Store it, send it to the client...
Or you could use websockets maybe MQTT. -
Floating point should be no problem, unless there is some really crazy math. Even if you must use some crazy math, you can use Compilation that compiles your JS code to C and runs at C code speed.
Haven't used, but the DPS310 has an impressive promo video.
Or (I guess you already have a Puck, so suggesting another buy is not really nice) you could by a Ruuvitag that's pretty weather-proof. Altho' the onboard BME 280's datasheet says it's relative accuracy is +-0.12hPa, that's about 1 meter, that's not as good as you would want.
allObjects could be right, not sure how much error would be due to the silicone cover's resistance in such small pressure changes...
-
The Bangle is a DT NO1 F18 watch reflashed, not custom hardware, so Gordon doesn't have the PCB files, but there is a lot of info in a recent thread. You can find some more info in the forum and the docs.
The source code is up at Github, main firmware with build instructions is at https://github.com/espruino/Espruino but check the other repos there as well. Everything is there Bangle apps, docs, PCB files for other Espruinos...
Personally I would love if long range BLE would work with Espruino. Not for a Bangle, but for home automation. Did some testing with Nordic's demo and has a pretty impressive range for 2.4GHz and PCB antenna. Tried to port to Espruino, but not enough time & skill yet. Even "just" advertising and scanning would be useful for tiny sensor nodes.
-
So, results are in:
The battery level says 100% earlier than charging terminates. But the "charge icon" - green plug near the battery -is shown until charging terminates.
The watch vibrates when charging is terminated (I guess there is a pin on the charge controller that tells the watch if it's charging or not), and the charge icon disappears as well.
I have the "Battery Level Widget (with percentage)", other widgets may behave differently, but the functionality is there. -
It's possible that that 100% indicator is not 100% accurate due to component tolerance.
Do you have a USB power meter (anything like these) to check if your watch is really being charged after it reaches 100%? Or a multimeter and some USB cable /connector you can hack away to measure current.
I do have a power meter, plugged in now, I will report back later.
-
-
-
What firmware version and what apps do you have on the bangle?
Got similar issues 1-2 months ago (without connect/disconnect messages on the watch), but has been better lately. If you have an older FW version, definitely try to update the firmware and clean all apps.And could be an issue with your laptop / computer. For example my phone (Huawei P10, nothing fancy) is much much better at bluetooth connectivity than my laptop (a Lenovo Thinkpad Edge gen2). Totally offtopic, but my wife's 10 year old Dell has much better wifi than a newer Dell I had...
-
Ok, what do you mean by "flashing does not work" ? If flashing won't work, nothing will work :)
After flashing Espruino, the dongle shows up as a virtual COM port, nothing special, Windows says the driver is by Microsoft, so you shouldn't need any special driver I think. Or BLE, no driver needed at all.So, I'm lazy to type so just use nRF Connect desktop's "Programmer". You can use the command line tools, the GUI is calling that, so the result should be the same...
- The hex's SHA1 should be: 57B9580CE13F18498255EFE8BEDF3370FF040ADB. Re-download if it's different! There is a tiny chance of wrong download...
- This will work if your dongle still has the original USB bootloader. If you have completely erased, or uploaded a different bootloader that doesn't work with
nrfjprog
, you will need an SWD programmer. But the end result should be the same. - Plug-in the dongle, and press the reset button (the one sideways). The red LED should start pulsing.
- Launch nRF Connect & programmer. Select the device (top-left). The contents of the dongle's memory should be visible on the left. See the screenshot
- Press "Clear files" if you have previously added any file. "Add HEX file" (top-right), select the dongle's hex and hit write. Should take half a minute or so.
- Unplug & re-plug the dongle!
- Now you should be able to connect to the dongle via BLE or USB. USB feels a bit not-so-perfect: I have to send an extra character sometimes to get the full response from the dongle. Didn't have this issue with BLE tho...
The programmer's log output should look like this:
2020-06-26T06:41:00.428Z INFO Using USB SDFU protocol to communicate with target 2020-06-26T06:41:00.446Z INFO Protocol Version: 1 found 2020-06-26T06:41:00.447Z INFO Hardware: 52840 found 2020-06-26T06:41:00.452Z INFO Firmware: Bootloader found 2020-06-26T06:41:00.452Z INFO Firmware: SoftDevice found 2020-06-26T06:41:00.453Z INFO Firmware: Application found 2020-06-26T06:41:17.200Z INFO Parsing HEX file: C:\dev\espruino\_firmware\nRF52840\espruino_2v06.6_nrf52840_dongle.hex 2020-06-26T06:41:17.201Z INFO File was last modified at 23/06/2020, 18:24:22 2020-06-26T06:41:17.475Z INFO SoftDevice detected, id 0xA9 (S140 v6.0.0) 2020-06-26T06:42:36.283Z INFO Does not need to be reloaded: C:\dev\espruino\_firmware\nRF52840\espruino_2v06.6_nrf52840_dongle.hex 2020-06-26T06:42:36.294Z INFO SdReq for SoftDevice is set as 0x00. 2020-06-26T06:42:36.296Z INFO Hash is generated by SHA256 2020-06-26T06:42:36.298Z INFO Hash is generated by SHA256 2020-06-26T06:42:36.311Z INFO Performing DFU. This may take a few seconds 2020-06-26T06:42:36.380Z INFO DFU procedure starts. This may take a few seconds. 2020-06-26T06:42:44.785Z INFO DFU for SoftDevice completed successfully! 2020-06-26T06:42:44.786Z INFO 1 dfu package(s) left. 2020-06-26T06:42:44.787Z INFO Waiting for device 2020-06-26T06:42:44.899Z INFO DFU procedure starts. This may take a few seconds. 2020-06-26T06:42:59.791Z INFO DFU for Application completed successfully! 2020-06-26T06:42:59.791Z INFO 0 dfu package(s) left. 2020-06-26T06:42:59.792Z INFO Waiting for device 2020-06-26T06:43:04.793Z ERROR Reopen device failed: Timeout while waiting for device C132E264CC6B to be attached and enumerated 2020-06-26T06:43:04.793Z INFO Nordic DFU Trigger Interface was not found.Please physically reset device. 2020-06-26T06:43:04.796Z ERROR Device not found due to failure during DFU 2020-06-26T06:43:04.810Z INFO Target device closed.
Small correction, looks like I lost my latest board file, so BTNs and LEDs are the same as on the devkit, and that's not correct. But for example
D6.toggle()
does toggle the green LED. Just look up the pin numbers in the dongle's user guide. - The hex's SHA1 should be: 57B9580CE13F18498255EFE8BEDF3370FF040ADB. Re-download if it's different! There is a tiny chance of wrong download...
Same with Vivaldi on Windows. It's Chromium based too, but web bluetooth doesn't work. Seb serial works tho. Reported to the developers, but still nothing. Btw Vivaldi on android can do web bluetooth.