Last active
April 1, 2021 20:11
-
-
Save houhr/cead42765bd1a5ee42d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Download Adafruit_NeoPixel.h here: https://github.com/adafruit/Adafruit_NeoPixel | |
#include <Adafruit_NeoPixel.h> | |
// Which pin on the Arduino is connected to the NeoPixels? | |
#define PIN 6 | |
// How many NeoPixels are attached to the Arduino? | |
#define NUMPIXELS 1 | |
// When we setup 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 = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); | |
int delayval = 500; // delay for half a second | |
void setup() { | |
pixels.begin(); // This initializes the NeoPixel library. | |
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255 | |
pixels.setPixelColor(0, pixels.Color(0,200,0)); // Moderately bright green color. | |
} | |
void loop() { | |
for (int i = 0; i <= 255; i++) { | |
pixels.setBrightness(i); | |
pixels.show(); // This sends the updated pixel color to the hardware. | |
delay(delayval); // Delay for a period of time (in milliseconds). | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment