forked from pburakov/hack_week_py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
42 lines (32 loc) · 984 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import time
from neopixel import *
from config import *
from utils import blink_onboard_led
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA,
LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL,
LED_STRIP)
strip.begin()
led_trigger = open('/sys/class/leds/led0/trigger', 'w')
led_trigger.write('gpio')
def test_main():
led = open('/sys/class/leds/led0/brightness', 'w')
led.write('1')
led.close()
for i in range(LED_COUNT):
strip.setPixelColor(i, Color(255, 0, 0))
strip.show()
blink_onboard_led()
time.sleep(1)
led = open('/sys/class/leds/led0/brightness', 'w')
led.write('0')
led.close()
for i in range(LED_COUNT):
strip.setPixelColor(i, Color(0, 255, 0))
strip.show()
blink_onboard_led()
time.sleep(1)
for i in range(LED_COUNT):
strip.setPixelColor(i, Color(0, 0, 255))
strip.show()
blink_onboard_led()
time.sleep(1)