Go Down

Topic: Connect to WiFi as an asynchronous functions? (Read 36 times) previous topic - next topic


I have project that reads sensor information, transmits it to a cloud service, and then goes into a deepsleep mode until the next reading.  Because i want the device to be in a deep sleep mode it means turning off the wifi so when it wakes up it must first reconnect to the wifi before being able to send data, but since I want the reading to be taken on a regular interval it means not waiting for the wifi to finish up connecting before taking the readings.

I'm fairly new to low power modes and interrupts so please bare with me.

What i would like is for the device to wake up just before I need to take the readings, based on a timer (HH:04:55).  Start an asynchronous function to reconnect to the wifi.  In the meantime it would take the readings on a timer (HH:05:00) and wait for the Promise to come back before sending it off to the cloud.  Once the information is sent, it goes back into deepsleep and waits for the next timer (HH:09:55).

Now this is something I could program in JS but i'm a little more lost in the Arduino IDE.  Can anyone give me a hand on where I should start with this? Many many many thanks!


I'm fairly new to low power modes and interrupts so please bare with me.
I'll bear with you, but please let's keep our clothes on. 

The Arduino doesn't really have the concept of an asynchronous task like you refer to.  there is no "background process" or anything like that.  This isn't a PC, it's a single core microprocessor. 

Now it may be possible to get your readings and handle your wifi the way you want.  But you'll have to have someone take a look at the code.  It's impossible to tell with how little information you've given.  What's the sensor?  What's the code that reads it?  What's the code you need the WiFi to run? 

Post something that we can work with and maybe we can help you find a solution. 
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

Go Up