-
Ok so I've now tested this using different USB plugs, cables and computers. The result is always the same, after maybe one or two hours. The Espruino WiFi seems to stop executing, and there led that is being used for sleep indicator, starts to flicker quickly and is no longer brightly lit.
Does this sound like it's trying to sleep?
I even added a ping back to the raspberry pi to make sure the connection stays alive every 15 seconds.
-
I am trying to update my Espruino Wifi to v106. It was recently updated to v105 without any issues.
Here's what i've tried:
- Put the Espruino Wifi into boot loader mode, the red and green light pulsate in sequence.
- Click the flash firmware button.
Error popup in the web ide says -
Firmware for this device can't be updated from the IDE at the moment.
(I used the above steps to update to v105 last week and it was successful)
- Put the Espruino Wifi into boot loader mode, the red and green light pulsate in sequence.
- Click flash from file button and locate previously downloaded - espruino_2v06_wifi.bin
This time I see:
Connected to COM1 (No response from board) Initializing... Error Flashing: Can't find STM32 bootloader. Make sure the chip is reset into bootloader mode by holding down BTN1 while pressing RST Disconnected from COM1
- Put the Espruino Wifi into boot loader mode, the red and green light pulsate in sequence.
-
-
Ok so now I have this very simple piece of my implementation and i'm still getting this dreaded error:
New interpreter error: FIFO_FULL
All I'm doing is the following:
const wifi = require('Wifi'); const WIFI_NAME = 'BTHub6-3TFX'; const WIFI_OPTIONS = { password : 'mypassword' }; function onInit() { wifi.connect(WIFI_NAME, WIFI_OPTIONS, (err) => { if (err) { console.log('Connection error: '+err); return; } console.log('Connected!'); }); }
I really don't understand why it just throws this error when I do anything with Wifi now, this was all working the other day.
Any ideas guys?
-
Hey AO good to hear from you. I only call onInit when I'm running in the web IDE.
I remove this call when I run save(); in the IDE.
I must admit the various methods of saving and running code on espruino don't make a lot of sense to a regular web developer such as myself. I'll need to do some reading up on this area.
-
I'm also unable to update to
v106
even though the red and green lights are pulsing as expected.Error Flashing: Can't find STM32 bootloader. Make sure the chip is reset into bootloader mode by holding down BTN1 while pressing RST.
Is there a way I can hard reset on Espruino Wifi? I'm running into a few issues lately.
-
So i've read the docs and I do indeed have console logs in my code, so my plan is to remove those, but I've somehow hit another issue. When I try to send code to my board i'm getting the following error.
New interpreter error: FIFO_FULL Connection error: No 'ready' after AT+RST
This is odd as it has been working from the web IDE just fine recently. Here's the source. I have a raspberry pi4 running nodered which reads sensors around the house, some of these send data via MQTT which i'm picking up with the Espruino Wifi.
const neo = require('neopixel'); const wifi = require('Wifi'); const WIFI_NAME = 'BTHub6-3TFX'; const WIFI_OPTIONS = { password : 'xxxxxxxx' }; let delay = 0; let rgb = new Uint8ClampedArray(36); function onInit() { setSleepIndicator(LED1); const server = '192.168.1.64'; const options = { client_id : 'random', keep_alive: 60, // keep alive time in seconds port: 1883, // port number clean_session: true, username: 'username', // default is undefined password: 'password', // default is undefined protocol_name: 'MQTT', // or MQIsdp, etc.. protocol_level: 4, // protocol level }; const mqtt = require('MQTT').create(server, options /*optional*/); mqtt.on('connected', () => { console.log('connected to broker'); mqtt.subscribe('doorOpen'); mqtt.subscribe('doorClosed'); mqtt.subscribe('heartbeat'); }); mqtt.on('publish', (pub) => { console.log('topic: '+pub.topic); console.log('message: '+pub.message); switch(pub.topic) { case 'doorOpen': console.log('doorOpen'); doorOpen(); break; case 'doorClosed': console.log('doorClosed'); doorClosed(); break; case 'heartbeat': if(parseInt(pub.message) > 1) { heartbeat(); }else{ motion(); } break; default: neo.write(B15, lights({r: 0, g: 0, b: 0})); break; } }); wifi.connect(WIFI_NAME, WIFI_OPTIONS, (err) => { if (err) { console.log('Connection error: '+err); return; } console.log('Connected!'); mqtt.connect(); }); function lights(colors) { for (let i = 0; i < rgb.length;) { rgb[i++] = colors.g; rgb[i++] = colors.r; rgb[i++] = colors.b; } return rgb; } function doorOpen() { neo.write(B15, lights({r: 0, g: 0, b: 0})); update({r: 255, g: 0, b: 0}); } function doorClosed() { neo.write(B15, lights({r: 0, g: 0, b: 0})); update({r: 0, g: 255, b: 0}); } function heartbeat() { neo.write(B15, lights({r: 0, g: 0, b: 0})); update({r: 0, g: 0, b: 255}); } function motion() { neo.write(B15, lights({r: 0, g: 0, b: 0})); update({r: 0, g: 255, b: 0}); } function update(color) { neo.write(B15, lights(color)); delay = setTimeout(() => { neo.write(B15, lights({r: 0, g: 0, b: 0})); }, 1000); } } onInit();
-
All my code is in an
onInit()
My project requires my device to connect to the WiFi. If my device is plugged into USB on my PC it works great and the red led is lit all the time.
If my device is plugged into a USB wall socket, it begins brightly lit. Then after a while it starts to flash on and off quickly. My code fails to execute it seems.
The led is set by the setSleepIndicator function call.
Espruino WiFi v1.05
-
Hi guys,
Just playing around with my original Esp. and with only one line of code from the official LEDs example on the site, oddly I'm getting:
1v86 Copyright 2016 G.Williams >ERROR: Could not open file : NO_PATH WARNING: Module "neopixel" not found Uncaught Error: Field or method "write" does not already exist, and can't create it on undefined at line 1 col 20 require("neopixel").write(B15, [255,0,0]);
Has something changed with how modules are required?
-
-
-
OK sorry @Robin, I see what you mean't with the
interval
I had set that to false initially, this was something I needed previously, but isn't required now.So thanks to you two, i've been able to debug this, and it turned out to be a problem with L46.
That test there sometimes didn't reset
i = 8
so the text was getting updated fine, but was so far scrolled away I could never see it.Thanks a lot.
-
Hey guys,
Thank you so much for taking the time to have a look at my code:
Good tips for debugging. I'll add an
on handler
.L24
.bind(this)
, I add these to every nested function to maintain function scope to avoid things like var temp = this etc.I've read about places to put the WiFi creds and yes I'll do that when i'm happy its working well.
If it's bad data or an out of range error, wouldn't that crash the whole thing? I mentioned that the Espruino is still calling the Pi4 every 3 seconds even after display stops, so surely there's no error here? Or could it be repeatedly throwing an error but still making calls?
Yes
setInterval
does return an integer, but JS will coerce this to false if 0 and true if its any value greater than 0, so I believe this is correct.Good tip about the
process.memory()
call and the try catch.Really appreciate the advice, will see what I can find out and report back.
-
Hey guys,
I have an Espruino WiFi (love this thing) with an 8x8 matrix led display as recommended here. I have node-red running on my Raspberry PI 4. My Espruino makes calls every 3 seconds to my PI to get the current time and displays it scrolling across the matrix.
The problem is it just stops after about 10 minutes, I checked the Rasperry Pi and it is still being called by the Espruino every 3 seconds in the log. So the reason it's not displaying could be in this script somewhere, just not sure how to even debug it...
var WIFI_NAME = "BTHub-XXX"; var WIFI_OPTIONS = { password : "XxXxX" }; var http = require("http"); var output = 'default text'; var interval = false; const ANODES = [B6,A7,A6,B9,A4,B8,B4,B3]; const CATHODES = [B0,B5,A0,B7,B10,A1,B1,A5]; var g = Graphics.createArrayBuffer(8,8,1); var wifi = require("Wifi"); function onInit() { wifi.connect(WIFI_NAME, WIFI_OPTIONS, function(err) { if (err) { console.log("Connection error: "+err); return; } console.log("Connected!"); getData(); start(); scroll(); }.bind(this)); } // Start scanning out the LED display function start() { console.log('start'); var b = new Uint8Array(g.buffer); // Pre-bind digitalWrites to make things faster var a = digitalWrite.bind(undefined,ANODES); var c = digitalWrite.bind(undefined,CATHODES.concat(ANODES)); return setInterval(function() { b.map((d,i)=>{c(65280^(256<<i));a(d);});c(65280); },10); // 100 Hz } function scroll() { var i = 8; if (interval) clearInterval(interval); interval = setInterval(function(){ if(i == -(output.length * 4)) i = 8; g.clear(); g.drawString(output, i, 2); i--; }, 100); } function getData() { setInterval(function(){ http.get("http://192.168.1.146:1880/hello-data", function(res) { res.on('data', function(data) { output = data; console.log(output); }.bind(this)); }); }.bind(this), 3000); }
-
It would be help full to explain what you want to achieve from a birds point of view.
So when I first got the original Espruino I created animations for my LED lights using setInterval functions.
The code quickly became verbose as I added more patterns. I experimented back then trying to use gsap but there wasn't enough memory.
When I decided to look again and was amazed that the Espruino WiFi version was out with more memory I thought my idea could work out.
Gsap is designed for the browser as it transitions elements in the DOM but can also transition values on objects you create yourself, therefore you're not restricted to just DOM objects or the window object in the browser.
I've since looked at smaller libraries that could work as I want to interpolate between values to use on these lights, the power of a tween library is that it has various helper functions like repeat, reverse and yo-yo to aid with creativity.
-
Ah so originally when I wanted to use the 'gsap' module, I thought I'd install it in the modules folder that was created by the sandbox project thingy. To do this all you need to do (as long as you have nodejs installed of course) is:
npm install gsap
This creates the 'node_modules' folder with another folder called gsap inside, inside this is all the files associated with the gsap module.
Then in node at least, you just require it and off you go...
What I hadn't realised (but do now after reading the forums) is that there was a beta NPM setup but that was dropped, possibly unrelated to my issue anyway (I'm digressing here) but I thought maybe the Espruino expected local modules to reside in a 'node_modules' folder, but it doesn't.
Hope that clears up any confusion I've caused?
-
I just renamed the 'TweenLite.min.js' to 'gsap' so I could do:
var gsap = require('gsap');
Didn't use node_modules anywhere. It works fine regardless of where my sandbox folder is in the two cases mentioned previously.
I think you're right about not being able to use this on Espruino though as I can't seem to call any functions on it.
I was hoping to use it with the WS2811 lights, I used to do all my anims manually with setInterval but I've extensive knowledge of this library from doing frontend dev over the years and had an idea to Tween values using this as it's so powerful, maybe it will work out or maybe it won't...
PS. It can be used on nodejs so maybe there's a way to get it to play with Espruino.
-
OK so this is now working, thank you for pointing me in the right direction with the question if I had written this module myself!!!
I created a quick module to check and that was indeed loaded correctly, which made me think ahhhh I need to rename the downloaded module so that the filename matches what the Espruino is looking for, this isn't necessary using node_modules as it uses the folder name as the mapping I believe.
So it is now loading the module as expected.. Sorry for the confusion and thanks for the support.
-
Just to confirm, module 'gsap' is one you created? (as it isn't present at)
No I want to use gsap from here, well specifically i will want TweenLite as I may run into memory problems as gsap could be too big I think.
https://www.npmjs.com/package/gsap
I tried a new folder at the C root, still no joy, it appears to me that it doesn't even attempt to look in the modules folder at all according to the console output...
-
Hi Robin,
Thanks for the reply, here's my answers to your questions...
What PC and OS is the IDE running on? -Desktop AMD 1700x custom built - Windows 10 professional
What is the version of IDE? native or Chrome? Settings >> About -Web IDE version 0.70.4 chrome app.
Version of Espruino? process.env - VERSION": "1v99",
"GIT_COMMIT": "f0d66ba",
"BOARD": "ESPRUINOWIFI",
"FLASH": 524288, "RAM": 131072,
"SERIAL": "29004900-0c513532-39333638",
"CONSOLE": "USB",
"MODULES": "Flash,Storage,fs," ... ",neopixel,Wifi,AT",
"EXPTR": 536871156Are you using an SD card? No sir
File Path to the sandbox folder? Settings >> Project - C:\git\espruino\leds
Here's the console messages:
Firmware >1.43 supports faster writes over USB
Set Slow Write = false
FIRMWARE: Current 1v99, Available 1v99
Device found {"bitrate":9600,"bufferSize":4096,"connectionId":12,"ctsFlowControl":false,"dataBits":"eight","name":"","parityBit":"no","paused":false,"persistent":false,"receiveTimeout":0,"sendTimeout":0,"stopBits":"one"}
[success] Connected to COM7Connected to COM7
loadModule(gsap)
ERROR: getURL("https://www.espruino.com/modules/gsap.min.js") error : Not Found
ERROR: getURL("https://www.espruino.com/modules/gsap.js") error : Not Found
WARNING: [notify_warn] Module gsap not found
Received a prompt after sending newline... good!
Splitting for reset(), delay 250 -
I have tried a few ways to put a module in my local project. In the web ide I have set a folder for a project, this created a bunch of folders, one of them modules - I have tried to NPM install a module gsap there but I cannot require this with:
var gsap = require('gsap');
I thought maybe it doesn't need to be in node_modules folder so I took out the gsap folder and only that is in modules, still can't find it.
I copied the min.js file to modules folder, still cannot require it there.
Both of these examples work if I use the cmd to run node and the require('gsap'). What is the correct way to require a module from modules folder in a project?
-
-
I got it working, I have both the Espruino v1.4 and the Pico. I'm using the Pico in this case. After re-soldering the pins I got the green light on the CC3000 (thanks for the 5V tip!) but still no connection.
The issue was I had just assumed that B3 - B8 were all along the same edge, after checking the diagram closely on the ref card I got with the Pico, I noticed my mistake and once I connected B8 it all worked without a hitch!
Could I just ask, what's the best way to connect wires to those smaller points on the short edge of the Pico? I'm using the jumper wires but the holes on the edge are tiny so I can't put a pin in there.
-
OK, what happens is that it seems to hang on the first line, the connect doesn't seem to return anything, if I add a console.log before and after that line, only the first line is output.
console.log("start"); // yes i see this var wlan = require("CC3000").connect(); console.log("damn it");// I don't get here wlan.connect( "AccessPointName", "WPA2key", function (s) { if (s=="dhcp") { require("http").get("http://www.pur3.co.uk/hello.txt", function(res) { res.on('data', function(data) { console.log(">" + data); }); }); } });
I am not the best in the world at soldering, it's possible that my pins are not soldered perfectly, I'll need to check those I guess. Do any of the LEDs on the CC3000 light up at all, nothing seems to on mine.
Even more sorry for a longer delay :)
So I'm using the Chrome App. I'm happy to report that I have updated to v1.07.
I honestly have no idea what finally fixed it, i've reinstalled the Chrome IDE many times, I've switched COM ports because sometimes it sees a port then when in bootloader mode that port now disappears.
Then all of a sudden COM port 5 appears in bootloader mode and boom I get to update the firmware.
So relieved it's finally worked but sorry can't explain what the cause was.