41 lines
1001 B
C++
41 lines
1001 B
C++
|
|
#include <Adafruit_NeoPixel.h> // version 1.15.2
|
|
|
|
|
|
#define PIN 18
|
|
#define NUMPIXELS 1
|
|
|
|
// When setting up the NeoPixel library, we tell it how many pixels,
|
|
// and which pin to use to send signals. Note that for older NeoPixel
|
|
// strips you might need to change the third parameter -- see the
|
|
// strandtest example for more information on possible values.
|
|
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
|
|
|
|
#define DELAYVAL 1000 // Time (in milliseconds) to pause between pixels
|
|
|
|
void setup() {
|
|
pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
|
|
}
|
|
|
|
void loop() {
|
|
// red
|
|
pixels.setPixelColor(0, pixels.Color(150, 0, 0));
|
|
pixels.show();
|
|
delay(DELAYVAL);
|
|
|
|
// green
|
|
pixels.setPixelColor(0, pixels.Color(0, 150, 0));
|
|
pixels.show();
|
|
delay(DELAYVAL);
|
|
|
|
// blue
|
|
pixels.setPixelColor(0, pixels.Color(0, 0, 150));
|
|
pixels.show();
|
|
delay(DELAYVAL);
|
|
|
|
// orange
|
|
pixels.setPixelColor(0, pixels.Color(150, 75, 0));
|
|
pixels.show();
|
|
delay(DELAYVAL);
|
|
}
|