Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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=['COM3']
- 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"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement