Created
August 20, 2015 19:14
-
-
Save thekitchenscientist/e4ccad18486bcdbbaf0b to your computer and use it in GitHub Desktop.
Byte Codes to control EV3 LEDs by dirrect command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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