Skip to content

Commit a890f5e

Browse files
kattnitannewt
authored andcommitted
Made pixels private, created property with docs (#9)
Made pixels private, created property with docs
1 parent 458ff07 commit a890f5e

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

adafruit_circuitplayground/express.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,21 @@ def __init__(self):
3737
# Define LEDs:
3838
self._led = digitalio.DigitalInOut(board.D13)
3939
self._led.switch_to_output()
40-
self.pixels = neopixel.NeoPixel(board.NEOPIXEL, 10)
40+
self._pixels = neopixel.NeoPixel(board.NEOPIXEL, 10)
41+
42+
# Define sensors:
43+
self._temp = adafruit_thermistor.Thermistor(board.TEMPERATURE, 10000, 10000, 25, 3950)
44+
self._light = Photocell(board.LIGHT)
45+
46+
# Define audio:
47+
self._speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE)
48+
self._speaker_enable.switch_to_output(value=False)
49+
50+
self.sample = None
51+
self.sine_wave = None
52+
53+
@property
54+
def pixels(self):
4155
"""Sequence like object representing the ten NeoPixels around the outside
4256
of the CircuitPlayground. Each pixel is at a certain index in the sequence
4357
as labeled below. Colors can be RGB hex like 0x110000 for red where each
@@ -61,17 +75,7 @@ def __init__(self):
6175
while True:
6276
pass
6377
"""
64-
65-
# Define sensors:
66-
self._temp = adafruit_thermistor.Thermistor(board.TEMPERATURE, 10000, 10000, 25, 3950)
67-
self._light = Photocell(board.LIGHT)
68-
69-
# Define audio:
70-
self._speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE)
71-
self._speaker_enable.switch_to_output(value=False)
72-
73-
self.sample = None
74-
self.sine_wave = None
78+
return self._pixels
7579

7680
@property
7781
def button_a(self):

0 commit comments

Comments
 (0)