-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added header file. Renamed to .ino because PlatformIO will then work with multiple files (platformio/platformio-core#130)
- Loading branch information
Showing
6 changed files
with
155 additions
and
57 deletions.
There are no files selected for viewing
Empty file.
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,48 @@ | ||
#include <arduino.h> | ||
|
||
void fadeall(uint8_t fade_all_speed) { | ||
for (uint8_t i = 0; i < NUM_LEDS; i++) { | ||
leds[i].nscale8(fade_all_speed); | ||
} | ||
} | ||
|
||
void brightall(uint8_t bright_all_speed) { | ||
for (uint8_t i = 0; i < NUM_LEDS; i++) { | ||
leds[i] += leds[i].scale8(bright_all_speed) ; | ||
} | ||
} | ||
|
||
|
||
void addGlitter( fract8 chanceOfGlitter) | ||
{ | ||
for ( uint8_t i = 0 ; i < 5 ; i++ ) { | ||
if ( random8() < chanceOfGlitter) { | ||
leds[ random16(NUM_LEDS) ] += CRGB::White; | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
// Custom mod which always returns a positive number | ||
int mod(int x, int m) { | ||
return (x % m + m) % m; | ||
} | ||
|
||
|
||
|
||
uint32_t getMasterNodeId() { | ||
uint32_t lowestId = UINT32_MAX ; | ||
SimpleList<uint32_t>::iterator node = nodes.begin(); | ||
while ( node != nodes.end() ) { | ||
if ( *node < lowestId ) { | ||
lowestId = *node ; | ||
} | ||
node++; | ||
} | ||
return lowestId ; | ||
} | ||
|
||
bool thisNodeMaster() { | ||
return mesh.getNodeId() == getMasterNodeId() ; | ||
} |
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,36 @@ | ||
#include <arduino.h> | ||
|
||
#ifdef RT_FADE_GLITTER | ||
void fadeGlitter() { | ||
addGlitter(90); | ||
FastLED.setBrightness( maxBright ) ; | ||
FastLED.show(); | ||
fadeToBlackBy(leds, NUM_LEDS, 200); | ||
} | ||
#endif | ||
|
||
|
||
#ifdef RT_DISCO_GLITTER | ||
void discoGlitter() { | ||
fill_solid(leds, NUM_LEDS, CRGB::Black); | ||
addGlitter(map( constrain( activityLevel(), 0, 3000), 0, 3000, 100, 255 )); | ||
FastLED.setBrightness( maxBright ) ; | ||
FastLED.show(); | ||
} | ||
#endif | ||
|
||
|
||
#ifdef RT_STROBE1 | ||
#define FLASHLENGTH 20 | ||
void strobe1() { | ||
if ( tapTempo.beatProgress() > 0.95 ) { | ||
fill_solid(leds, NUM_LEDS, CHSV( map( yprX, 0, 360, 0, 255 ), 255, 255)); // yaw for color | ||
} else if ( tapTempo.beatProgress() > 0.80 and tapTempo.beatProgress() < 0.85 ) { | ||
fill_solid(leds, NUM_LEDS, CRGB::White ); | ||
} else { | ||
fill_solid(leds, NUM_LEDS, CRGB::Black); // black | ||
} | ||
FastLED.setBrightness( maxBright ) ; | ||
FastLED.show(); | ||
} | ||
#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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// prototype methods: | ||
void receivedCallback( uint32_t from, String &msg ); | ||
void newConnectionCallback(uint32_t nodeId) ; | ||
void changedConnectionCallback() ; | ||
void nodeTimeAdjustedCallback(int32_t offset) ; | ||
void delayReceivedCallback(uint32_t from, int32_t delay) ; | ||
void setTapTempo() ; | ||
uint32_t getMasterNodeId() ; | ||
bool thisNodeMaster() ; | ||
void checkButtonPress() ; |
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,26 @@ | ||
== Startup Procedure == | ||
start up rainbow routine | ||
connect to mesh | ||
blink LED to indicate connection | ||
sync time and BPM | ||
elect MASTER with lowest ID | ||
receive pattern from MASTER | ||
|
||
== Patterns == | ||
=== All Nodes Same Pattern === | ||
* synchronized heartbeat, | ||
* sync twirl/cylon | ||
* disco glitter and fade glitter | ||
* palette patterns | ||
|
||
=== Multi-Node Patterns === | ||
* Strobe | ||
** split mesh into 2, 3 or 4 groups; | ||
* Alternate between nodes with cylon/VU meter | ||
* Twirl by group standing in circle and each strand lights up sequentially | ||
* Combine all LEDs strands into 1 long LED array for patterns like RT_THREE_SIN_PAL, RT_JUGGLE_PAL and RT_BOUNCEBLEND | ||
|
||
|
||
== UI/UX == | ||
* Set BPM: short click | ||
* Switch pattern: long click |