Skip to content

Instantly share code, notes, and snippets.

@thomasbrueggemann
Created October 6, 2018 19:23
Show Gist options
  • Save thomasbrueggemann/0d166a121d187c4432d71427804498e2 to your computer and use it in GitHub Desktop.
Save thomasbrueggemann/0d166a121d187c4432d71427804498e2 to your computer and use it in GitHub Desktop.
#include <FastLED.h>
#define LED_PIN 5
#define NUM_LEDS 30
#define ANIMATION_FRAME_TIME 80
CRGB leds[NUM_LEDS];
int counter = 0;
void setup() {
Serial.begin(115200);
pinMode(5, OUTPUT);
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
}
void loop() {
int current = counter % NUM_LEDS;
int second = (counter + 11);
int third = (counter + 22);
counter++;
if(counter > NUM_LEDS / 3) counter = 0;
for(int led = 0; led < NUM_LEDS; led++) leds[led] = CRGB (0, 0, 0);
leds[current] = CRGB (194, 71, 0);
if(second < 30) leds[second] = CRGB (194, 71, 0);
if(third < 30) leds[third] = CRGB (194, 71, 0);
FastLED.show();
delay(200);
}
@thomasbrueggemann
Copy link
Author

  • Wemos d1 green to green LED wire
  • Wemos 5V to red LED wire to Battery +
  • Wemos GND to white LED wire to Battery -

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment