Skip to content

Instantly share code, notes, and snippets.

@smilbandit
Created August 26, 2017 04:32
Show Gist options
  • Save smilbandit/2739c77601577333ac403c7f4a08fc70 to your computer and use it in GitHub Desktop.
Save smilbandit/2739c77601577333ac403c7f4a08fc70 to your computer and use it in GitHub Desktop.
Blinkt example that mimic Cylon eyes
#!/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