Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add precompile switch for NeoPixel LED strips instead of DotStar #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion chromance-firmware/chromance-firmware.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@

(C) Voidstar Lab 2021
*/
/* Choose one: DotStar or NeoPixel */
#define DOTSTAR
// #define NEOPIXEL

#ifdef DOTSTAR
#include <Adafruit_DotStar.h>
#endif
#ifdef NEOPIXEL
#include <Adafruit_NeoPixel.h>
#endif
#include <SPI.h>
#include <ArduinoOSC.h>
#include <WiFi.h>
Expand All @@ -27,12 +35,21 @@ const int recv_port = 42069; // Port that OSC data should be sent to (pick one,

int lengths[] = {154, 168, 84, 154}; // Strips are different lengths because I am a dumb

#ifdef DOTSTAR
Adafruit_DotStar strip0(lengths[0], 15, 2, DOTSTAR_BRG);
Adafruit_DotStar strip1(lengths[1], 0, 4, DOTSTAR_BRG);
Adafruit_DotStar strip2(lengths[2], 16, 17, DOTSTAR_BRG);
Adafruit_DotStar strip3(lengths[3], 5, 18, DOTSTAR_BRG);

Adafruit_DotStar strips[4] = {strip0, strip1, strip2, strip3};
#endif

#ifdef NEOPIXEL
Adafruit_NeoPixel strip0(lengths[0], 15, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip1(lengths[1], 0, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip2(lengths[2], 16, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip3(lengths[3], 5, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strips[4] = {strip0, strip1, strip2, strip3};
#endif

byte ledColors[40][14][3]; // LED buffer - each ripple writes to this, then we write this to the strips
float decay = 0.97; // Multiply all LED's by this amount each tick to create fancy fading tails
Expand Down