So I decided to be lazy and just have my clock’s interface be a computer program:
Tweet
import datetime import glob import serial import sys import time if len(sys.argv) > 1: port = sys.argv[1] else: port = glob.glob('/dev/tty.usbmodem*')[0] print "Writing to %s" % port arduino = serial.Serial(port, 9600) time.sleep(3) arduino.write("SEIZE\n") result = arduino.readline().strip() if not result == "YOU": print("Clock not found\n") sys.exit(1) print("Clock found, setting to current time.") arduino.write("SET\n"); print(arduino.readline().strip()); arduino.write("%s\n" % time.strftime('%b %d %Y')); print(arduino.readline().strip()); arduino.write("%s\n" % time.strftime('%H:%M:%S')); print(arduino.readline().strip());