Skip to content

Instantly share code, notes, and snippets.

@jbfink
Created May 18, 2011 18:47
Show Gist options
  • Save jbfink/979236 to your computer and use it in GitHub Desktop.
Save jbfink/979236 to your computer and use it in GitHub Desktop.
python arduino console
import serial
import time
baudrate = raw_input("Please enter the required baud rate:")
## You need to add the locations for your system, i.e. COM* for Windows, /dev/tty* for Nix systems
locations=['/dev/ttyACM0']
for device in locations:
try:
print "Trying...", device
arduino = serial.Serial(device, baudrate)
break
except:
print "Failed.."
count = 5
time.sleep(1)
while count < 10:
try:
print arduino.readline()
except:
print "Fail"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment