Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python2.7
- #MD Harrington For Bryan Cairns Void realms re MySQL and serial port interaction #
- # Following code is fine with arduino dot matrix display on its own #
- import serial
- import syslog
- import time
- #The following line is for serial over GPIO
- port='/dev/ttyACM0'
- baudrate=57600
- ser = serial.Serial(port,baudrate,timeout=5)
- with open('mytext.txt') as fp:
- lines = fp.readlines()
- for line in lines:
- m_array = line.encode('ascii')
- time.sleep(6)
- ser.write(m_array)
- #Serial read section
- msg = ser.readline()
- print ("Message from arduino: ")
- print (msg)
- else:
- print "Exiting"
- ser.close()
- exit()
Add Comment
Please, Sign In to add comment