def init(): ppi.init() driveMotors(0, 0)
# Create a TCP/IP socket and bind the socket to the port sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_address = (IP_ADDRESS, PORT) print('Starting up on {0}, port {1}'.format(server_address[0], server_address[1]), file=sys.stderr) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.bind(server_address) mA = ppi.Motor(ppi.AD_MOTOR_A) mB = ppi.Motor(ppi.AD_MOTOR_B) display = ppi.Display(ppi.AD_DISPLAY_A) #initialise serial, and retrieve initial values from the Atmega ppi.init() mA.get_all() mB.get_all() # Initialise loop variables connection = None client_address = None # initialize the heartbeat thread heartbeat_thread = threading.Thread(target=HeartBeat, daemon=True) heartbeat_thread.start() # attempt to get the low byte of the WLAN IP address try: f = os.popen( 'sudo ifconfig wlan0 | grep "inet\ addr" | cut -d: -f2 | cut -d" " -f1'
def __init__(self): self.mA = ppi.Motor(ppi.AD_MOTOR_A) self.mB = ppi.Motor(ppi.AD_MOTOR_B) ppi.init()