Created
May 18, 2011 18:47
-
-
Save jbfink/979236 to your computer and use it in GitHub Desktop.
python arduino console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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