-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Faster communication between server and controller - More robust protocol with start/end characters - Update rate from client to led strip ~10x faster - Ack sent from controller to server, server retries if nothing received - Server automatically flashes led strip controller on launch - New Christmas and Confetti light modes - Removed slow rainbow - Added slider to adjust speed (led refresh rate) - Minor code-style improvements - Read serial data using serialEvent(), store in buffer
- Loading branch information
Showing
13 changed files
with
374 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#ifndef LIGHT_STRIP_CONTROLLER_CHRISTMAS_H | ||
|
||
#define LIGHT_STRIP_CONTROLLER_CHRISTMAS_H | ||
|
||
#include "constants.h" | ||
#include <FastLED.h> | ||
|
||
void christmas(CRGB *leds, uint8_t *dat) | ||
{ | ||
if (*dat == 0) | ||
{ | ||
// White, Green, White, Red | ||
fill_gradient_RGB(leds, 0, CRGB::CadetBlue, NUM_LEDS / 4 - 1, CRGB::Green); | ||
fill_gradient_RGB(leds, NUM_LEDS / 4, CRGB::Green, NUM_LEDS / 2 - 1, CRGB::CadetBlue); | ||
fill_gradient_RGB(leds, NUM_LEDS / 2, CRGB::CadetBlue, NUM_LEDS / 4 * 3 - 1, CRGB::Red); | ||
fill_gradient_RGB(leds, NUM_LEDS / 4 * 3, CRGB::Red, NUM_LEDS - 1, CRGB::CadetBlue); | ||
*dat = 1; | ||
} | ||
else | ||
{ | ||
// save the first element | ||
CRGB first = leds[0]; | ||
// shift every element down one | ||
for (int i = 1; i < NUM_LEDS; i++) | ||
{ | ||
leds[i - 1] = leds[i]; | ||
} | ||
// put the first element in the last slot | ||
leds[NUM_LEDS - 1] = first; | ||
} | ||
} | ||
|
||
uint8_t *init_christmas_dat() | ||
{ | ||
uint8_t *dat = (uint8_t *)malloc(sizeof(uint8_t)); | ||
*dat = 0; | ||
|
||
return dat; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef LIGHT_STRIP_CONTROLLER_CONFETTI_H | ||
|
||
#define LIGHT_STRIP_CONTROLLER_CONFETTI_H | ||
|
||
#include "constants.h" | ||
#include <FastLED.h> | ||
|
||
// Adapted from https://github.com/atuline/FastLED-Demos/blob/master/confetti/confetti.ino | ||
|
||
void confetti(CRGB *leds, uint8_t *dat) | ||
{ | ||
(void)dat; | ||
|
||
fadeToBlackBy(leds, NUM_LEDS, CONFETTI_DECAY_RATE); | ||
int pos = random16(NUM_LEDS); | ||
leds[pos] += CHSV((*dat + random16(256))/4 , CONFETTI_SATURATION, 255); // 12 bits for hue so that the hue increment isn't too quick. | ||
*dat++; | ||
} | ||
|
||
uint8_t *init_confetti_dat() | ||
{ | ||
uint8_t *dat = (uint8_t *)malloc(sizeof(uint8_t)); | ||
*dat = 0; | ||
|
||
return dat; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.