![]() Gw.sleep(DOOR_PIN - 2, CHANGE, MAILBOX_PIN - 2, CHANGE, sleepTime) Unsigned long sleepTime = 86400000UL // 1 day (compiled but not tested) // Simple binary switch example I added your battery library and your interrupts: OldValue = I couldn't compile your example so I went at the problems. Gw.send(msg.setSensor(i).set(value = HIGH? 1 : 0), false) Setup the buttons and Activate internal pull-ups #define DOOR_PIN 3 // Arduino Digital I/O pin for button/reed switch Test it (I compiled but didn't test) and then add in your sleep and battery stuff. Here's a setting up the two interrupts this way. I'm a bit proud to have built this into a small enclosure. ![]() Int batteryPcnt = fuelGauge.stateOfCharge() Check if digital input has changed and send in new value If S_LIGHT is used, remember to update variable type you send in. You can use S_DOOR, S_MOTION or S_LIGHT here depending on your usage. Register binary input sensor to gw (they will be created as child devices) After setting up the button, setup debouncer MyMessage msgMail(CHILD_ID_MAIL,V_TRIPPED) MyMessage msgDoor(CHILD_ID_DOOR,V_TRIPPED) Change to V_LIGHT if you use S_LIGHT in presentation below Unsigned long SLEEP_TIME = 86400000 // 1 day #define MAIL_PIN 3 // Arduino Digital I/O pin for button/reed switch #define DOOR_PIN 2 // Arduino Digital I/O pin for button/reed switch And if I get mail (and the slot opens) the second interrupt should trigger. So if the door opens, one interrupt should trigger. The problem is that I don't know how to get two interrupts running at the same time. One sensor will be on my apartments front door, while the other sensor will sit on the mailbox-slot. I have one arduino and two door/window sensors. I've been looking around the forum for a solution, but haven't found one.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |