Created
October 8, 2016 05:09
-
-
Save openopen114/99ecd0c4677c440503ead916026655ba to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
ser = serial.Serial('/dev/tty.usbmodem1411', 9600) | |
time.sleep(1) | |
print ser.name | |
while(1): | |
word = raw_input('> ') | |
if(word == "end"): | |
break; | |
#Sends the text one character at a time | |
for x in range(0, len(word)): | |
ser.write(word[x]) | |
time.sleep(.01) | |
line = ser.readline() | |
if len(line)>=1 : | |
print line | |
#Closes the connection | |
ser.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment