Skip to content

Instantly share code, notes, and snippets.

@pingswept
Created August 6, 2013 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pingswept/6166847 to your computer and use it in GitHub Desktop.
Save pingswept/6166847 to your computer and use it in GitHub Desktop.
Code for listening to a USB RFID reader on the Rascal and then triggering an audio file to play when a card is detected. The code in action: https://vimeo.com/71829779
#!/usr/bin/env python
import sys
import subprocess as subp
while(1):
sys.stdin = open('/dev/tty0', 'r')
rfid_data = raw_input()
print "Read code from RFID reader: {0}".format(rfid_data)
subp.Popen('aplay --buffer-time=100000 /home/root/calm-16-bit-pcm.wav', shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment