Skip to content

Instantly share code, notes, and snippets.

@memish
Created October 25, 2017 17:20
Show Gist options
  • Save memish/9dc136294aad4e81f735bc19b3fcc684 to your computer and use it in GitHub Desktop.
Save memish/9dc136294aad4e81f735bc19b3fcc684 to your computer and use it in GitHub Desktop.
#include "LPD8806.h"
#include "SPI.h" // Comment out this line if using Trinket or Gemma
#ifdef __AVR_ATtiny85__
#include <avr/power.h>
#endif
// Number of RGB LEDs in strand:
int nLEDs = 32;
int countess=0;
// Chose 2 pins for output; can be any valid output pins:
int dataPin = 13;
int clockPin = 11;
int starter = 0;
int count = 0;
// First parameter is the number of LEDs in the strand. The LED strips
// are 32 LEDs per meter but you can extend or cut the strip. Next two
// parameters are SPI data and clock pins:
LPD8806 strip = LPD8806(nLEDs, dataPin, clockPin);
void setup(void)
{
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000L)
clock_prescale_set(clock_div_1); // Enable 16 MHz on Trinket
#endif
// Start up the LED strip
strip.begin();
// Update the strip, to start they are all 'off'
strip.show();
}
void loop(void)
{
strip.setPixelColor(4, strip.Color( 0, 0, 127)); // Set new pixel 'on'
strip.show(); // Refresh LED states
strip.setPixelColor(3, 0); // Erase pixel, but don't refresh!
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment