Skip to content

Instantly share code, notes, and snippets.

@hitherejoe
Created February 11, 2019 05:36
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 hitherejoe/d0b4b5dfa4daa2c5f3e4c5852a577469 to your computer and use it in GitHub Desktop.
Save hitherejoe/d0b4b5dfa4daa2c5f3e4c5852a577469 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import RPi.GPIO as GPIO
import braille_mapper
import time
def read_braille(braille_strings):
for sequence in braille_strings:
display_braille_sequence(sequence)
time.sleep(.400)
def display_braille_sequence(sequence):
braille = braille_mapper.convertTextToBraille(sequence)[0]
print(braille)
if (braille[0] == '1'):
GPIO.output(17,GPIO.LOW)
else:
GPIO.output(17,GPIO.HIGH)
if (braille[1] == '1'):
GPIO.output(27,GPIO.LOW)
else:
GPIO.output(27,GPIO.HIGH)
if (braille[2] == '1'):
GPIO.output(22,GPIO.LOW)
else:
GPIO.output(22,GPIO.HIGH)
if (braille[3] == '1'):
GPIO.output(23,GPIO.LOW)
else:
GPIO.output(23,GPIO.HIGH)
if (braille[4] == '1'):
GPIO.output(24,GPIO.LOW)
else:
GPIO.output(24,GPIO.HIGH)
if (braille[5] == '1'):
GPIO.output(25,GPIO.LOW)
else:
GPIO.output(25,GPIO.HIGH)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment