Create a gist now

Instantly share code, notes, and snippets.

anonymous /
Created Feb 12, 2013

What would you like to do?
import serial
import random
import time
import string
# Change timeout so we can quickly see what's wrong
arduino = serial.Serial(port='/dev/cu.usbserial-A600egLQ', baudrate=115200, timeout=0.1)
print "Connected:", arduino.isOpen()
testList = []
c = 0
while (c < 10):
a = random.randint(50,150)
# Length will be 9 always (c<10 determines how many items we have)
length = len(testList)
points = 20
writeString = str(length) + str(testList) + str(points)
print "Writing this string:", writeString
d = 0
dataList = []
while (d < points):
readIn = arduino.readline()
# Print the actual string we get - maybe we don't get \r\n at the end
print repr(readIn)
point = string.translate(readIn, None, deletions='\r\n')
print point
maximum = max(dataList)
print 'The Maximum point returned is:', maximum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment