Best way to combine two sketches using interrupt and sleep time?
-
I want to combine the soil-moisture and the temp sketch into one. But they use different methods to sleep between redings. The soil-moisture-sketch uses interrupt and the temp sleeps for a specific time.
What would be the best way to combine those two to be able to save as much battery power as possible? If I would be fine with them both reading the sensor-values for example every 5 min, can I just copy the loop block from the moisture sketch into the bottom of the loop of the temp sensor sketch?
-
You can actually combine both I think. Search for sleep. There is a sleep function
bool sleep(int interrupt, int mode, unsigned long ms=0);that both listenes to an interrupt and wakes up after a certain time. The return boolean value indicates which one.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login