• I check the setTimeout method in this case based on this link, but due to the project requirement, I would prefer reading the data without any interruption for hours (with setTimeout, the code pause about at around 20s automatically with no error), I am wondering if there is a way to do it without pause the program?

    Or Does Espruino Pico support this kind of application?


  • Sun 2019.11.03

    'I would prefer reading the data without any interruption for hours'


    Note that there isn't the function setTimeout() in the code snipit provided

    It appears the setTimeout() found in link in #12 is allowing everything to settle before executing the function. Maybe it is setInterval() that will repetitively call the function, after the timeout duration is over, perhaps?




    ' I am wondering if there is a way to do it without pause the program?'

    Would a better tutorial assist here?


    From #11

    'but I actually set SPI transmission rate to 10 MHz'

    Is hardware or software SPI in use?

    See Note: "baud:integer=100000, // ignored on software SPI"


    'Figure 3 shows the error I am getting and the program crashed.'

    "Prompt not detected - Upload failed"

    Was code on the Right-hand editor side of the WebIDE being uploaded while the * while{} * loop was still executing?


    After thinking this through, I believe the while loop is executing faster than the SPI send-response can keep up. Using setInterval() instead of the loop would be a better practice. See the data collection logging tutorial link above.

    The following paragraph may not apply then.

    In the code block in #11, variable start is never re-evaluated or re-assigned. Loop execution would be unpredictable. Infinitely fast looping until 20 seconds have elapsed. Also in line tm = readtime() the function definition is not present. Please upload all code using the following:

    I placed instructions for easy code insertion within each post at the end of #10. Including that way will allow us to block copy your code and comments from hilighting using Ctrl+C right here in the forum edit window. We would have line numbers to reference as well. Would greatly assist us.


Avatar for user101931 @user101931 started