CiferTech
Published © GPL3+

What Are NeoPixel LEDs?

Create your own color!

BeginnerFull instructions provided3,318
What Are NeoPixel LEDs?

Things used in this project

Story

Read more

Schematics

bandicam_2019-10-08_02-25-31-497_qNyOAGJaIO.jpg

Code

Untitled file

C/C++
#define DELAYVAL 500 // Time (in milliseconds) to pause between pixels

void setup() {
  // These lines are specifically to support the Adafruit Trinket 5V 16 MHz.
  // Any other board, you can remove this part (but no harm leaving it):
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif
  // END of Trinket-specific code.

  pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
}

void loop() {
  pixels.clear(); // Set all pixel colors to 'off'

  // The first NeoPixel in a strand is #0, second is 1, all the way up
  // to the count of pixels minus one.
  for(int i=0; i<NUMPIXELS; i++) { // For each pixel...

    // pixels.Color() takes RGB values, from 0,0,0 up to 255,255,255
    // Here we're using a moderately bright green color:
    pixels.setPixelColor(i, pixels.Color(0, 150, 0));

    pixels.show();   // Send the updated pixel colors to the hardware.

    delay(DELAYVAL); // Pause before next pass through loop
  }
}

Credits

CiferTech

CiferTech

35 projects • 98 followers
I'm known as Cifer. I'm an Electronic, Embedded sys, Robotic, IoT Engineer - PCB Designer.

Comments