Hello,
I’m trying to get readings of %V (Supply Voltage) of an xbee module router mode placed on a xbee dev. board (xbib) on a periodic basis via a .py device driver.
The Condition:
#1 Obtain %V value
#2 If %V value => 3000mV, return True
#3 If %V value < 3000mV, return False.
I’m trying to achieve knowing whether my xbib board is powered with Vin or not (in this case, an xbee module Router mode is attached to it). Hence the Boolean property
I’ve theorized into 2 ways of doing it:
[A]
#1. Create a XBeeDeviceManagerRunningEventSpec(). This will return the %V value when the device has transitioned to the running stage
#2. Create a XBeeDeviceManagerRxEventSpec(). This will return the %V value whenever the device manager “receives a parameter”
#3. Device Manager polls for xbib to return %V value every x period
#4. If value detected; return True to its respective channel property. If value not detected, and timeout occurs; return False
[B]
#1. Repeat steps [A]#1 - #2.
#2. Sample %V according to the period of XBee S2 Chip IR parameter.
#3. Channel Property shows True when %V value obtained.
#4. Channel Property shows False when %V value could not be obtained after a timeout occurs.
My limitations:
On method [A], I’m trying to achieve obtaining %V value at
i) t = 0: device cannot be discovered, hence returns False;
ii) t = 1: device is switch ON and discovered, hence returns True;
iii) t = 2: device is switch OFF, hence returns False
I’ve successfully implemented i) and ii). But struggling to achieve iii) because I’m not sure how I can run [A]#3 (Device Manager polls for xbib to return %V value every x period). A while loop don’t fix it because it will continuously run the loop and if exit, it won’t run the loop again. Feeling lost on how to proceed.
On method [B],
I’m not sure how I can run [B]#2. (Sample %V according to the period of XBee S2 Chip IR parameter.) To tie the IR value to a time function, is just as challenging as method [A].
I would appreciate feedback and opinions on how I should work on them and some directions on how to do them. Kinda stuck too long here.
I’m attaching the python code I’m working on
Disclaimer: Code adapted and modified from post: http://www.digi.com/support/forum/viewthread_thread,999#3836; - A resourceful work from lynnl’s