"var Clock ..." prevents code execution (?) #341
Replies: 8 comments
-
Posted at 2015-01-07 by @gfwilliams Hi Daniel, What do you mean by 'won't work anymore'? Are there any error messages, or does it fail in some specific way? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-01-07 by stozk The web IDE will just stop after ">echo(0);" with no error message. If I leave out just the Clock module import it will execute the code up to the point where it tries to initialize the clk variable and throw an error message, so I guess the Clock module import seems to be the problem somehow. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-01-07 by @gfwilliams Thanks - and you've got the latest firmware (1v71) and you're running on the Espruino board? Can you try re-writing your code as the following and see if it helps?
This was an issue a while back (the time taken to execute the code in modules meant that Espruino wasn't ready to accept more code later on) but I really thought that it was sorted now. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-01-07 by stozk Yes, it's running 1v71. I've also tried to remove the ADXL335 accelerometer code and it also worked. I'll try another accelerometer sensor, looks like the Clock module and the ADXL335 don't like each other for now. BR |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-01-07 by @gfwilliams Can you first try:
I didn't spot the first bit with wlan in - it might be the delay caused by trying to connect to the CC3000, so it may help to move it to onInit. But to get running from the SD card, try:
Otherwise the Web IDE will load the modules in anyway - the |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-01-07 by DrAzzy Are you sure it's not the size of the data it's sending, and some sort of communication issue? That would explain the "it works if I remove any one part" effect... It isn't even doing anything until onInit() runs... Try using throttled send to make sure it's not that (under settings -> communication)? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-01-07 by @gfwilliams
It's doing 'wlan.connect()' which if I remember takes a second or so? Anything after that would just fill up the USB buffer, and eventually the PC just stops bothering to send the data and drops it :( |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-01-07 by stozk Thanks Gordon, moving the wlan connection to onInit seems to be the solution, it works now ;-) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2015-01-07 by stozk
Hi everyone
I have used this code to retrieve sensor data:
This works just fine. Since I also want to have current timestamps for the sensordata logging, I tried to set the clock as described in the reference, which results in this:
But this code won't execute. The clock code parts will work on their own, but as soon as I try to initialize the Clock module with the previous sensor/wifi code, it won't work anymore.
Any ideas?
BR
Daniel
Beta Was this translation helpful? Give feedback.
All reactions