Skip to content

Instantly share code, notes, and snippets.

@thekitchenscientist
Created August 20, 2015 19:14
Show Gist options
  • Save thekitchenscientist/e4ccad18486bcdbbaf0b to your computer and use it in GitHub Desktop.
Save thekitchenscientist/e4ccad18486bcdbbaf0b to your computer and use it in GitHub Desktop.
Byte Codes to control EV3 LEDs by dirrect command
import time
LED_off = '\x08\x00\x00\x00\x80\x00\x00\x82\x1B\x00'
LED_green = '\x08\x00\x00\x00\x80\x00\x00\x82\x1B\x01'
LED_orange = '\x08\x00\x00\x00\x80\x00\x00\x82\x1B\x03'
LED_red = '\x08\x00\x00\x00\x80\x00\x00\x82\x1B\x02'
# send commands to EV3 via bluetooth
with open('/dev/rfcomm0', 'w', 0) as bt:
bt.write(LED_red)
time.sleep(1)
bt.write(LED_orange)
time.sleep(1)
bt.write(LED_green)
time.sleep(1)
bt.write(LED_off)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment