-
• #2
Hi Sven,
console.log
will be ok if you're just powered from USB, although it tends to lock up if it is actually connected to USB but no terminal app is used (because Espruino doesn't want to throw away the data you're telling it to write, but the Mac/PC is not reading any data from it).So I think your issue is that you're not initialising the CC3000 on startup. When you type
save()
, Espruino will resume from where it was when you saved it - but the CC3000 won't remember what it was doing :)There's a better example of creating a server that can work at power-on here: http://www.espruino.com/WiFi+Enabled+Thermometer
It uses the special function
onInit
which is called when Espruino starts up.Looking at it, I think there may still be a problem with that example though. Instead, copy the example apart from the line
onInit();
right at the end. Now, typesave()
and Espruino's state will be saved, and immediately after, it'll restart andonInit()
will be called.Now if you connect to a USB power supply it should be fine.
This is a bit strange and most likely user error. But here it is: I created an espruino script with the web ide and create a server on port 80 - this all works when I transfer the script via the web ide.
I then write save(); via the web ide command line to save the program to flash, disconnect from the mac's USB and plug the espruino via the same USB cable into a USB power supply. I've tried this a couple of times now, but the server is no longer available. I also checked my router, the espruino did get assigned the same IP.
Because I had no idea how console.log() works or what it does, I commented out these calls. Would that be OK to leave them in, even though the USB cable is just a power supply?
But again, this does not seem the real issue. Is save() the issue? What do I need to do if I want to save a script in the espruino and boot it up whenever I connect the espruino to power?
Thx
Sven