import serial from visual import * lt = range(0,256) p = 1. for i in range(0,256): b = '' j = 0 temp = i chksum = 0 while temp > 0: b = str(temp % 2) + b temp = temp >> 1 for j in range(0, len(b)): chksum = chksum + int(b[j]) lt[i]=chksum fifolen=960 fifo=range(fifolen-1) scene.title = "Orion REG live stream" scene.width = 800 scene.height = 600 band = curve( x = arange(-20,20,0.01), y = 0, radius = 0.1, color=color.white) ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=1) ser.setRTS(1) ser.setDTR(1) ser.flushInput() for i in range(fifolen): fifo[:-1] = fifo[1:] fifo[-1] = lt[ord(ser.read())]-4 while 1: fifo[:-1] = fifo[1:] fifo[-1] = lt[ord(ser.read())]-4 p = sum(fifo)/96. band.y[:-1] = band.y[1:] band.pos[-1] = (20,p,0)