// Jeff Ritchie 2 15 2026 revision- pulse
// based on adafruit neopixel example sketch
#include <Adafruit_NeoPixel.h>//pulls the Neopixel library
#ifdef __AVR__ //if an AVR board, use the library below. RP2040 is not an AVR.
#include <avr/power.h>
#endif
#define PIN D0 //RP2040 uses D6 rather than pin 6
#define NUMPIXELS 16 //
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); //creates an instance called pixels
//third parameters indicate color in green red blue white order and the signal frequency of 800khz
#define DELAYVAL 500 //sets delay variable that makes it easier to change. Originally 500ms
void setup() {
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
pixels.begin();
}
void loop() {
static int brightness = 0;
static int direction = 1;
pixels.setBrightness(brightness);
for(int i=0; i<NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(255, 0, 0));
}
pixels.show();
brightness += direction;
if(brightness >= 150 || brightness <= 5) {
direction = -direction;
}
delay(DELAYVAL);
}
Loading
xiao-esp32-c6
xiao-esp32-c6