I think I found a bug with the uint16_t ZBRxIoSampleResponse::getAnalog function
I noticed that if pin1 is not enabled for Analog that the returned by
this function is off by 1 pins worth of data. When pin 1 is enabled
everything worked fine. I finally noticed that this for loop has a
problem.
for (int i = 0; i < pin; i++) {
if (isAnalogEnabled(pin)) {
start+=2;
}
}
Instead of checking isAnalogEnabled(pin) it should be
isAnalogEnabled(i). If you have an analog ping enabled that is
greater than an analog pin that is disabled, this will cause all
enabled pins afterward to be returned incorrectly.
Let me know if i missed something, but I'm pretty sure that is a needed change.
--
AJ Ragusa
for (int i = 0; i <= 4; i++) {
if (ioSample.isAnalogEnabled(i)) {
nss.print("Analog (AI");
nss.print(i, DEC);
nss.print(") is ");
nss.println(ioSample.getAnalog(i), DEC);
}
}
the case statement of the for loop should be
i<4
because we start at 0, and I believe a check for pin 7 should also be
in there because pin 7 may return the supply voltage for the XBee. I
don't think this matters as much, but it would be useful to prevent
confusion, and document the supply voltage part.
A.J.
> --
> You received this message because you are subscribed to the Google Groups "xbee-api" group.
> To post to this group, send email to xbee...@googlegroups.com.
> To unsubscribe from this group, send email to xbee-api+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/xbee-api?hl=en.
>
>
--
AJ Ragusa
ara...@indiana.edu
812-606-8516