Zachary A Porter
import serial import sys from time import * # index is between 0 and 2 # value is true or false for on or off def set_status(index,value): if value: ser.write([0,index]) else: ser.write([1,index]) ret_val = ser.read_all()[0] assert not ret_val == 3 return ret_val # get the status of an outlet def get_status(index): ser.write([2,index]) ret_val = ser.read_all()[0] assert not ret_val == 3 return ret_val-4 == 0
All content on this page belongs to Zachary Porter. You may use, reproduce, or modify anything from this website, provided that you give credit to zackporter.com in your usage.