Skip to content

Instantly share code, notes, and snippets.

@cbscribe
Created December 15, 2020 19:15
Show Gist options
  • Save cbscribe/78c8f18281653ab9cdf2fbcbd9e24946 to your computer and use it in GitHub Desktop.
Save cbscribe/78c8f18281653ab9cdf2fbcbd9e24946 to your computer and use it in GitHub Desktop.
NeoPixel example code - Lights up the string in two different colors
#include <Adafruit_NeoPixel.h>
#define LED_PIN 2
#define NUM_LEDS 12
Adafruit_NeoPixel pixels(NUM_LEDS, LED_PIN,
NEO_GRB + NEO_KHZ800);
void setup()
{
pixels.begin();
}
void loop()
{
for (int i = 0; i < NUM_LEDS; i++)
{
pixels.setPixelColor(i, pixels.Color(110, 255, 0));
pixels.show();
delay(100);
}
for (int i = 0; i < NUM_LEDS; i++)
{
pixels.setPixelColor(i, pixels.Color(255, 255, 10));
pixels.show();
delay(100);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment