You are reading a single comment by @Gordon and its replies.
Click here to read the full conversation.
-
thank you again @Gordon!
I will try both. I think its the watchdog that may kick in.
Again, I dont think another device would be able to connect to it. Currently I have the button set to change the status LED between on/off. When it gets stuck it does not work either.
No problem! If you need it, the connections are at http://www.espruino.com/Puck.js#serial-console
For the watchdog timer you just need http://www.espruino.com/Reference#l_E_enableWatchdog
So if you do
E.enableWatchdog(2);
then if Espruino crashes such that it's not executing anything in setInterval, it'll automatically reboot.You can go one step further and manually poke it in your code, so you know that if your code doesn't execute that line in X seconds the device reboots:
You just need to watch out that if you go to update the firmware the watchdog will still be running and may cause a reboot if it isn't enabled in the new bit of code you update.
As I said above though, one reason you may not see it advertising is if some other device has automatically connected to it.
You could always add
setWatch(()=>NRF.disconnect(),BTN,{repeat:true})
so when the button is pressed it disconnects from whatever it is connected to, and that might help?