Import time
from mote import Mote
import serial.tools.list_ports
list = serial.tools.list_ports.comports()
#connected = []
#Find the MOTE Hubs! This machine has 2 installed
var1 = 1
for element in list:
if ‘Mote’ in element.description:
if var1 == 1:
mote1 = Mote(port_name=element.device)
var1 = 2
elif var1 == 2:
mote2 = Mote(port_name=element.device)
#clear channels on both hubs
mote1.configure_channel(1, 16, False)
mote1.configure_channel(2, 16, False)
mote1.configure_channel(3, 16, False)
mote1.configure_channel(4, 16, False)
mote2.configure_channel(1, 16, False)
mote2.configure_channel(2, 16, False)
mote2.configure_channel(3, 16, False)
mote2.configure_channel(4, 16, False)
mote1.clear()
mote2.clear()
#make one blue and one green… so we see all 8 strips lit up on both.
for channel in range(1, 5):
for pixel in range(16):
mote1.set_pixel(channel, pixel, 0, 0, 255)
mote2.set_pixel(channel, pixel, 0, 255, 0)
mote1.show()
mote2.show()
#but only do this for 5 seconds
time.sleep(5)
#then turn off the demo
mote1.clear()
mote1.show()
mote2.clear()
mote2.show()