Skip to content

Instantly share code, notes, and snippets.

@thekitchenscientist
Created August 20, 2015 19:42
Show Gist options
  • Save thekitchenscientist/f53eebb7549f4434d015 to your computer and use it in GitHub Desktop.
Save thekitchenscientist/f53eebb7549f4434d015 to your computer and use it in GitHub Desktop.
import serial
from dec_to_hex import h # decimal-to-hexadecimal dictionary
EV3 = serial.Serial('/dev/rfcomm0')
# message length
bytecount = h[44] #look up 44 in hex dictionary
comm_0 = '\x00'
# message counter
comm_1 = '\x00\x00'
# no reply
comm_2 = '\x80'
# globals
comm_3 = '\x00\x00'
# opUI_Draw
comm_4 = '\x84'
#blank screen
comm_5 = '\x13\x00\x82\x00\x00\x82\x00\x00'
#logo
comm_6 = '\x84\x1C\x01\x82\x00\x00\x82\x32\x00\x84\x75\x69\x2F\x6D\x69\x6E\x64\x73\x74\x6F\x72\x6D\x73\x2E\x72\x67\x66\x00'
#update
comm_7 = '\x84\x00'
command = bytecount + comm_0 + comm_1 + comm_2 + comm_3 + comm_4 + comm_5 + comm_6 + comm_7
EV3.write(command)
EV3.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment