Skip to content

Instantly share code, notes, and snippets.

@Tejkaran
Created March 23, 2017 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tejkaran/6529577e4fa939392fc563d0a5eb4b78 to your computer and use it in GitHub Desktop.
Save Tejkaran/6529577e4fa939392fc563d0a5eb4b78 to your computer and use it in GitHub Desktop.
FastLED HSV Example
#include "FastLED.h"
#include <SPI.h>
#define NumPixels 50 // number of LEDs in strip - count starts at 0, not 1
#define DataRate_Mhz 8 // how fast data refreshes at - [----CHECK THIS----] - slower rates are more successful when timing is not essential!!!!!
#define DataPin 11 // data pin
#define ClockPin 13 // clock Pin
CRGB leds[NumPixels];
void setup()
{
FastLED.addLeds<APA102,DataPin,ClockPin,BGR,DATA_RATE_MHZ(DataRate_Mhz)>(leds,NumPixels);
Serial.begin(115200); // set the speed at which serial monitor will write at
fill_solid(leds, NumPixels, CRGB(0,0,0)); // fill all black
FastLED.show(); // show
delay(1000); // saftey first
pinMode(7, OUTPUT); // if using the prop shield this is required
digitalWrite(7, HIGH); // if using the prop shield this is required
}
void loop()
{
static uint8_t hue = 0;
for(int i = 0; i < NumPixels; i++)
{
fill_solid(leds, NumPixels, CHSV(hue++,255,20)); // light up whole strip
// leds[i] = CHSV(hue++, 255, 255); // Set the i'th led to red
FastLED.show(); // Show the leds
delay(150);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment