Hi guys! I hope this is the right place to upload my programming concern.
I have been using two XBees and two Arduino boards to make them communicate with each other wirelessly.
Currently, I am using Andrew Rapp's library, "XBee.h" to make the XBee modules to communicate with each other. I have a Switch set up on a transmitter side, connected to DIO12 on the XBee. I want the Switch to have two functionalities:
When I click it, it changes the Switch mode (for instance, let's say that the variable switchMode is assigned as 1 when I clicked on it). When switchMode == 1, the LED on the other Arduino board turns on. Then if I click it once more, the Switch mode, switchMode changes to 0 and the LED shuts down. If I click it once more, it changes back to 1, turns on the LED, and so on. The Switch doesn't care if I am pressing it for a long time; I must release it press it again. I was able to successfully program this first functionality. However...
I have a problem with this one. Under a different condition, I want this same Switch to react to a press. Different from the first functionality where it didn't care if I pressed it for a while, I want the LED to light up only while I press on the Switch. Then if I release it, the LED would shut down.
How could I use Andrew Rapp's library, "XBee.h" to solve this problem? Right now, I tried to create a new instance of
"switch = !ZBioSample.isDigitalOn(switchList)"
but I just cannot seem to find a solution. I would appreciate your thoughts on this. If you have more questions please ask me.