Adafruit_Learning_System_Gu.../NeoRGB_Stemma_Examples/circuitpython/code.py
Liz a364295859 adding examples for the neorgb stemma breakout
adding arduino and CP examples for the neorgb stemma breakout. CP example checks for raspberry pi
2024-02-16 16:11:17 -05:00

29 lines
691 B
Python

# SPDX-FileCopyrightText: 2024 Liz Clark for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
import board
from rainbowio import colorwheel
import neopixel
num_pixels = 1
# pylint: disable=simplifiable-condition
# check to see if its a raspberry pi
if "CE0" and "CE1" in dir(board): # pi only zone
pixel_pin = board.D18
# otherwise assume a microcontroller
else:
pixel_pin = board.D5
pixels = neopixel.NeoPixel(pixel_pin, num_pixels)
color_offset = 0
while True:
for i in range(num_pixels):
rc_index = (i * 256 // num_pixels) + color_offset
pixels[i] = colorwheel(rc_index & 255)
pixels.show()
color_offset += 1
time.sleep(0.01)