Skip to content

Commit c268264

Browse files
committed
Update to upcoming NeoPixel API
1 parent dd5d11c commit c268264

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

examples/spinner.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ def get_position(self, delta):
5555

5656

5757
# Initialize NeoPixels and accelerometer.
58-
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10)
58+
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, auto_write=False)
5959
pixels.fill((0,0,0))
60-
pixels.write()
60+
pixels.show()
6161
i2c = busio.I2C(board.ACCELEROMETER_SCL, board.ACCELEROMETER_SDA)
6262
lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c, address=25)
6363

@@ -111,6 +111,6 @@ def get_position(self, delta):
111111
# pixels ahead, wrapping back to the start) to the primary color.
112112
pixels[pos] = PRIMARY_COLOR
113113
pixels[(pos + 5) % 10] = PRIMARY_COLOR
114-
pixels.write()
114+
pixels.show()
115115
# Small delay to stay responsive but give time for interrupt processing.
116116
time.sleep(0.05)

examples/spinner_advanced.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def update(self, position, primary, secondary):
131131
for i in range(self._dots):
132132
pos = int(position + i*self._dot_offset) % self._pixels.n
133133
self._pixels[pos] = primary
134-
self._pixels.write()
134+
self._pixels.show()
135135

136136
class SmoothAnimation:
137137

@@ -158,13 +158,13 @@ def update(self, position, primary, secondary):
158158
for i in range(self._pixels.n):
159159
x = math.sin(self._sin_scale*i - phase)
160160
self._pixels[i] = color_lerp(x, -1.0, 1.0, primary, secondary)
161-
self._pixels.write()
161+
self._pixels.show()
162162

163163

164164
# Initialize and turn off NeoPixels.
165-
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10)
165+
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, auto_write=False)
166166
pixels.fill((0,0,0))
167-
pixels.write()
167+
pixels.show()
168168

169169
# Initialize buttons.
170170
button_a = digitalio.DigitalInOut(board.BUTTON_A)

0 commit comments

Comments
 (0)