update for pwmio
This commit is contained in:
parent
f050c19756
commit
4cc6f27cf8
1 changed files with 5 additions and 7 deletions
|
|
@ -11,7 +11,7 @@ requires:
|
|||
import time
|
||||
import random
|
||||
import board
|
||||
import pulseio
|
||||
import pwmio
|
||||
from simpleio import map_range
|
||||
|
||||
RED = [100, 0, 0]
|
||||
|
|
@ -26,13 +26,12 @@ WHITE = [100, 100, 100]
|
|||
BLACK = [0, 0, 0]
|
||||
color_array = [RED, ORANGE, YELLOW, GREEN, TEAL, BLUE, CYAN, MAGENTA, WHITE, BLACK]
|
||||
|
||||
red_led = pulseio.PWMOut(board.D9)
|
||||
green_led = pulseio.PWMOut(board.D10)
|
||||
blue_led = pulseio.PWMOut(board.D11)
|
||||
red_led = pwmio.PWMOut(board.D9)
|
||||
green_led = pwmio.PWMOut(board.D10)
|
||||
blue_led = pwmio.PWMOut(board.D11)
|
||||
|
||||
rgb_led_array = [red_led, green_led, blue_led]
|
||||
|
||||
|
||||
def set_color(color):
|
||||
"""sets the rgb led's cathodes."""
|
||||
print("Setting (%0.2f, %0.2f, %0.2f)" % (color[0], color[1], color[2]))
|
||||
|
|
@ -46,7 +45,6 @@ def random_color():
|
|||
rnd_color = random.randrange(len(color_array))
|
||||
set_color(color_array[rnd_color])
|
||||
|
||||
|
||||
while True:
|
||||
random_color()
|
||||
time.sleep(2)
|
||||
Loading…
Reference in a new issue