1- import time
2-
3-
41NUM_PIXELS = 4
52NEO_PIXELS_IN_PIN = 22
63
74try :
85
6+ # set to True if don't want to use PIO
97 if False :
108 raise Exception ("I don't want to use PIO" )
119
@@ -74,7 +72,7 @@ def ShowNeoPixels(*pixels):
7472
7573
7674if ShowNeoPixels is None :
77-
75+ # in case cannot / wouldn't drive NeoPixels with PIO, define an adapter here to use the standard APIs
7876 try :
7977 from machine import Pin
8078 from neopixel import NeoPixel
@@ -92,9 +90,9 @@ def ShowNeoPixels(*pixels):
9290 except :
9391 ShowNeoPixels = None
9492
95- Pixels = []
96- for i in range ( NUM_PIXELS ):
97- Pixels . append ( None )
93+
94+ Pixels = [ None ] * NUM_PIXELS
95+
9896
9997from dumbdisplay .core import *
10098from dumbdisplay .layer_lcd import *
@@ -130,15 +128,17 @@ def ShowNeoPixels(*pixels):
130128advance_button .writeCenteredLine (">>>" )
131129advance_button .enableFeedback ("fl" )
132130
133-
131+ # create 7-seg layer for the R HEX value
134132r_7seg_layer = Layer7SegmentRow (dd ,2 )
135133r_7seg_layer .border (10 , "black" )
136134r_7seg_layer .backgroundColor ("white" , 50 )
137135
136+ # create 7-seg layer for the G HEX value
138137g_7seg_layer = Layer7SegmentRow (dd ,2 )
139138g_7seg_layer .border (10 , "black" )
140139g_7seg_layer .backgroundColor ("white" , 50 )
141140
141+ # create 7-seg layer for the B HEX value
142142b_7seg_layer = Layer7SegmentRow (dd ,2 )
143143b_7seg_layer .border (10 , "black" )
144144b_7seg_layer .backgroundColor ("white" , 50 )
@@ -254,6 +254,7 @@ def ShowNeoPixels(*pixels):
254254 if r != old_r or g != old_g or b != old_b :
255255 # set the background color of the color layer to the new (r, g, b) color
256256 color_layer .backgroundColor (RGB_COLOR (r , g , b ))
257+ # shows the R/G/B values on the 7-seg layers
257258 r_7seg_layer .showHexNumber (r )
258259 g_7seg_layer .showHexNumber (g )
259260 b_7seg_layer .showHexNumber (b )
0 commit comments