Skip to content

Instantly share code, notes, and snippets.

@gregatsoon
Created July 27, 2012 11:24
Show Gist options
  • Save gregatsoon/3187476 to your computer and use it in GitHub Desktop.
Save gregatsoon/3187476 to your computer and use it in GitHub Desktop.
PN532_read
#!/usr/bin/env python
import serial
serial_port = '/dev/tty.usbmodemfa131'
baud_rate = 115200
def run_server():
print 'Starting serial server...'
try:
com = serial.Serial(serial_port, baud_rate)
print 'Connected to arduino. Awaiting RFID scans.'
chars = []
while True:
char = com.readline()
print char
except serial.SerialException:
print '*ERROR*'
sys.exit('Something went wrong...')
def main():
run_server()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment