Skip to content

Commit 1f5072f

Browse files
authored
Merge pull request #1465 from brentru/update-metrox-pwmio
Update MetroX example to pwmio
2 parents f050c19 + 4cc6f27 commit 1f5072f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

MetroX_CircuitPython/mib_colorful_light.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import time
1212
import random
1313
import board
14-
import pulseio
14+
import pwmio
1515
from simpleio import map_range
1616

1717
RED = [100, 0, 0]
@@ -26,13 +26,12 @@
2626
BLACK = [0, 0, 0]
2727
color_array = [RED, ORANGE, YELLOW, GREEN, TEAL, BLUE, CYAN, MAGENTA, WHITE, BLACK]
2828

29-
red_led = pulseio.PWMOut(board.D9)
30-
green_led = pulseio.PWMOut(board.D10)
31-
blue_led = pulseio.PWMOut(board.D11)
29+
red_led = pwmio.PWMOut(board.D9)
30+
green_led = pwmio.PWMOut(board.D10)
31+
blue_led = pwmio.PWMOut(board.D11)
3232

3333
rgb_led_array = [red_led, green_led, blue_led]
3434

35-
3635
def set_color(color):
3736
"""sets the rgb led's cathodes."""
3837
print("Setting (%0.2f, %0.2f, %0.2f)" % (color[0], color[1], color[2]))
@@ -46,7 +45,6 @@ def random_color():
4645
rnd_color = random.randrange(len(color_array))
4746
set_color(color_array[rnd_color])
4847

49-
5048
while True:
5149
random_color()
52-
time.sleep(2)
50+
time.sleep(2)

0 commit comments

Comments
 (0)