• @robin.
    I understand that code. but can't see what it would do. You are essentially asking me to have it wait for the init. then wait 1.5 seconds and then call the method to connect to the internet. Is this correct?

    I've tried something similar in that I put the intial call on a timeout of 5 seconds and it didn't help.

    plus I'm just wondering why it'll sometimes work (after a couple of days of not working) but only in debug mode.

    again. it's no consitant. It's not a save or a reboot or code that changes it. It's just waiting.

    @allObjects I think you're talking about the same thing that robin is talking about. Having the system wait a while and then call the request.

    I have the system poll the price ever 5 minutes. I tried that every 2 minutes and waited (the 2 minutes) and the second call failed just line the first on the initial bootup.

  • 'me to have it wait for the init'

    The E.on('init' runs after all the code is uploaded.



    'then call the method to connect to the internet. Is this correct'

    Effectively yes, but with what ever values would work with the boards you have. Without calls to your code being inside an init function, the demo code you are woking from is attempting to setup the WiFi module at the same time that code is being uploaded through the WebIDE. After save() and no WebIDE, nothing is properly initialized as the init() function fires. That said, the following trio are more likely the culprit:

    'plus I'm just wondering why it'll sometimes work (after a couple of days of not working) '

    Yes, we are also!!


    'but only in debug mode.'

    Am I to take this to mean when running within the WebIDE?
    Are the devices remaining powered up during this waiting period?


    'I have the system poll the price ever 5 minutes'
    post #51 'the code is the exact same from the example'

    From that reply, I have to make the assumption that the polling process is actually more code that was added to the 'exact code' that was implied in post #51?

    Which means as @allObjects suggested a week ago, that something in the http request section is locking up? Looking for that post reference. . . .

    EDIT: Damian, see @allObjects #34 post regarding function getPrice() that I pointed to in #33 from the code snippet you posted in #32. Should this function be part of the 'exact code' as you put it; Is the http request being closed? Posting that function with your p/w credentials replaced will help us all here. Q: Does the board pair remain functioning when the getPrice() function is removed? It is starting to look like a combination of factors. . .

    Could it be that the WebIDE Chrome Window (browser) is actually assisting in keeping the connection alive. Then after a few days of off time, all http (or WiFi) stuff is effectively re-init'd?

    and what about the hardware watchdog? This comment is more for the others, and as I have no experience with the -01, so am not sure how to do this 'feeding' task using Espruino as there is no loop() function as with Arduino.



Avatar for Robin @Robin started