Skip to content

Instantly share code, notes, and snippets.

@hsiboy
Created January 25, 2015 19:48
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hsiboy/4eae11073e9d5b21eae3 to your computer and use it in GitHub Desktop.
Save hsiboy/4eae11073e9d5b21eae3 to your computer and use it in GitHub Desktop.
WS2811 - breathe demo for Peter Swanton
#include <FastLED.h>
// change these to match your hardware setup
#define LED_PIN 13 // hardware SPI pin SCK
#define NUM_LEDS 250
#define COLOR_ORDER RGB
#define LED_TYPE WS2811
#define MAX_BRIGHTNESS 255 // watch the power!
struct CRGB leds[NUM_LEDS];
void setup()
{
LEDS.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setBrightness(MAX_BRIGHTNESS);
FastLED.clear();
fill_solid(leds, NUM_LEDS, CRGB::White);
}
void loop () {
float breath = (exp(sin(millis()/2000.0*PI)) - 0.36787944)*108.0;
FastLED.setBrightness(breath);
FastLED.show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment