29 lines
807 B
Python
29 lines
807 B
Python
from telemetrix_rpi_pico import telemetrix_rpi_pico
|
|
from time import sleep as delay
|
|
import signal
|
|
import sys
|
|
import colorsys
|
|
from time import perf_counter as millis
|
|
def sigint_handler(signal, frame):
|
|
print ('KeyboardInterrupt is caught')
|
|
board.shutdown()
|
|
sys.exit(0)
|
|
signal.signal(signal.SIGINT, sigint_handler)
|
|
board = telemetrix_rpi_pico.TelemetrixRpiPico()
|
|
board.set_pin_mode_neopixel(pin_number=2,num_pixels=60)
|
|
board.neopixel_clear(auto_show=True)
|
|
SEGMENT_SIZE = 1
|
|
VELOCITY = 10
|
|
NUM_LEDS = 60
|
|
color = []
|
|
k = 0
|
|
timecounter = 0
|
|
while(True):
|
|
for j in range(0,NUM_LEDS):
|
|
|
|
r, g, b = colorsys.hsv_to_rgb(((-timecounter*VELOCITY+j*2)%360)/360,1,1)
|
|
board.neo_pixel_set_value(j,r=int(r*255),g=int(g*255),b=int(b*255))
|
|
timecounter+=1
|
|
delay(0.05)
|
|
board.neopixel_show()
|