Created
November 30, 2016 20:10
-
-
Save VlastimilHovan/fbdbb30b579cfd2442fd9fc7bc66e806 to your computer and use it in GitHub Desktop.
BBC microbit colour sensor (code release)
This file contains hidden or 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
from microbit import * | |
analog_val = 0 | |
while True: | |
analog_val = pin0.read_analog() | |
if (button_a.is_pressed() == True): | |
if ((analog_val >= 835) & (analog_val <= 920)): | |
display.scroll("Black", delay=100) | |
if ((analog_val >= 700) & (analog_val <= 818)): | |
display.scroll("Blue", delay=100) | |
if ((analog_val >= 511) & (analog_val <= 613)): | |
display.scroll("Green", delay=100) | |
if ((analog_val >= 60) & (analog_val <= 170)): | |
display.scroll("White", delay=100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment