Open igoralves98 opened 8 years ago
Hi @igoralves98,
Could you please specify the XBee modules and firmware version you are using?
Remember that when you press and release the button, you are going to receive two samples: one for the press action and another one for the release action. What it's weird is that you sometimes receive three... (maybe mechanical issues?)
Anyway, you should change the way you compare the received IO sample, it's wrong to compare two strings with ==
. In addition we have an enumeration class for the IO values:
if (ioSample.getDigitalValue(IOLine.DIO4_AD4) == IOValue.HIGH) {
...
} else {
...
}
Thanks.
This issue has been banging my head...
I'm building a java program that will be able to open/close my garage door and monitor the respective status.
For this i wrote a initialization class that register an IOSampleListener using this code:
localDevice.addIOSampleListener(new PortaoGaragemListener());
The class PortaoGaragemListener.java is above:
The program works almost fine.
I say almost because sometimes, when I press and release the button, the listener is suddenly called two and sometimes three times.
I'm using log4j2 and this implementation is giving me several debug information of the communication between the two xbees and, I was able to see that the tx/rx is running smoothly when I do not register a listener class but, when I instantiate the listener I got this issue.
My xbee connection is above: