Skip to content

Instantly share code, notes, and snippets.

@brodul
Created November 18, 2017 00:50
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 brodul/706d29c3ec3f8a2d7da9f1ff91df9fab to your computer and use it in GitHub Desktop.
Save brodul/706d29c3ec3f8a2d7da9f1ff91df9fab to your computer and use it in GitHub Desktop.
import os
import serial
commands = {
'ON_C': b'0',
'DOWN_VOLUME_C': b'1',
'UP_VOLUME_C': b'2',
'MUTE_C': b'3',
'DVD_C': b'4',
'TV_C': b'5',
'GAME_C': b'6',
'CD_MP3_C': b'7',
}
def figure_out_serial():
devs = os.listdir('/dev/')
try:
devs = [file_ for file_ in devs if 'ttyUSB' in file_][0]
except KeyError:
print("USB serial not found")
raise
def main():
pass
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment