Skip to content

Instantly share code, notes, and snippets.

@openopen114
Created October 8, 2016 05:09
Show Gist options
  • Save openopen114/99ecd0c4677c440503ead916026655ba to your computer and use it in GitHub Desktop.
Save openopen114/99ecd0c4677c440503ead916026655ba to your computer and use it in GitHub Desktop.
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