-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathigniter_gui.py
More file actions
26 lines (19 loc) · 888 Bytes
/
igniter_gui.py
File metadata and controls
26 lines (19 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
##just a quick demo to show how to enable a xbee device, create a callback, and send commands through the command window
import serial.tools.list_ports
from digi.xbee.devices import XBeeDevice
from time import gmtime, strftime
global text
messages = []
comport_list=[] #list of available ports for the user to choose from
comport_list.append([comport.device for comport in serial.tools.list_ports.comports()])
#menu to select comport, in case it isnt com8...
device = XBeeDevice("COM8",9600)
device.open()
def data_receive_callback(xbee_message):
text = "From %s %s >> %s" % (xbee_message.remote_device.get_64bit_addr(),strftime("%H:%M:%S"),xbee_message.data.decode())
messages.append(text)
print(text)
device.add_data_received_callback(data_receive_callback)
#device.send_data_broadcast('ping')
device.send_data_broadcast('ping')
print('hi')