Created
August 26, 2017 04:32
-
-
Save smilbandit/2739c77601577333ac403c7f4a08fc70 to your computer and use it in GitHub Desktop.
Blinkt example that mimic Cylon eyes
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
#!/usr/bin/env python | |
import time | |
import blinkt | |
blinkt.set_clear_on_exit() | |
blinkt.set_brightness(0.1) | |
x = 0 | |
d = 1 | |
while True: | |
blinkt.clear() | |
blinkt.set_pixel(x,128,0,0,0.5) | |
y = x - d | |
if y > 0 or y < 7: | |
blinkt.set_pixel(y,255,0,0,0.1) | |
if x > 6: | |
d = -1 | |
if x < 1: | |
d = 1 | |
x += d | |
blinkt.show() | |
time.sleep(0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment