Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Adafruit_NeoPixel.h>
- #ifdef __AVR__
- #include <avr/power.h>
- #endif
- #define PIN_NFC 1
- #define PIN_ACTIVATION 7
- #define PIN_PATHWAY1 9
- #define PIN_ELEVATOR 10
- #define PIN_CHASE 11
- #define PIN_PATHWAY2 12
- #define PIN_COLORIZER A1
- #define NUM_NFC 22
- #define NUM_ACTIVATION 116
- #define NUM_PATHWAY1 128
- #define NUM_ELEVATOR 298
- #define NUM_CHASE 53
- #define NUM_PATHWAY2 65
- #define NUM_COLORIZER 255
- #define BRIGHTNESS 100
- const int numOfBytes = 298;
- Adafruit_NeoPixel strip_nfc = Adafruit_NeoPixel(NUM_NFC, PIN_NFC, NEO_GRBW + NEO_KHZ800);
- Adafruit_NeoPixel strip_activation = Adafruit_NeoPixel(NUM_ACTIVATION, PIN_ACTIVATION, NEO_GRBW + NEO_KHZ800);
- Adafruit_NeoPixel strip_pathway1 = Adafruit_NeoPixel(NUM_PATHWAY1, PIN_PATHWAY1, NEO_GRBW + NEO_KHZ800);
- Adafruit_NeoPixel strip_elevator = Adafruit_NeoPixel(NUM_ELEVATOR, PIN_ELEVATOR, NEO_GRBW + NEO_KHZ800);
- Adafruit_NeoPixel strip_chase = Adafruit_NeoPixel(NUM_CHASE, PIN_CHASE, NEO_GRBW + NEO_KHZ800);
- Adafruit_NeoPixel strip_pathway2 = Adafruit_NeoPixel(NUM_PATHWAY2, PIN_PATHWAY2, NEO_GRBW + NEO_KHZ800);
- Adafruit_NeoPixel strip_colorizer = Adafruit_NeoPixel(NUM_COLORIZER, PIN_COLORIZER, NEO_GRBW + NEO_KHZ800);
- char inputBuffer[numOfBytes];
- byte neopix_gamma[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
- 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5,
- 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10,
- 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16,
- 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25,
- 25, 26, 27, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36,
- 37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 50,
- 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68,
- 69, 70, 72, 73, 74, 75, 77, 78, 79, 81, 82, 83, 85, 86, 87, 89,
- 90, 92, 93, 95, 96, 98, 99,101,102,104,105,107,109,110,112,114,
- 115,117,119,120,122,124,126,127,129,131,133,135,137,138,140,142,
- 144,146,148,150,152,154,156,158,160,162,164,167,169,171,173,175,
- 177,180,182,184,186,189,191,193,196,198,200,203,205,208,210,213,
- 215,218,220,223,225,228,231,233,236,239,241,244,247,249,252,255 };
- void setup() {
- strip_nfc.setBrightness(BRIGHTNESS);
- strip_activation.setBrightness(BRIGHTNESS);
- strip_pathway1.setBrightness(BRIGHTNESS);
- strip_elevator.setBrightness(BRIGHTNESS);
- strip_chase.setBrightness(BRIGHTNESS);
- strip_pathway2.setBrightness(BRIGHTNESS);
- strip_colorizer.setBrightness(BRIGHTNESS);
- strip_nfc.begin();
- strip_activation.begin();
- strip_pathway1.begin();
- strip_elevator.begin();
- strip_chase.begin();
- strip_pathway2.begin();
- strip_colorizer.begin();
- delay(500);
- Serial.begin(115200);
- Serial.setTimeout(500);
- strip_nfc.show();
- strip_activation.show();
- strip_pathway1.show();
- strip_elevator.show();
- strip_chase.show();
- strip_pathway2.show();
- strip_colorizer.show();
- }
- void loop() {
- if(Serial.available() > 0) {
- Serial.readBytes(inputBuffer, numOfBytes);
- }
- if(inputBuffer[0] == 0){
- for (int j= 0; j < NUM_NFC; j++) {
- int r = inputBuffer[(j*3)+1];
- int g = inputBuffer[(j*3)+2];
- int b = inputBuffer[(j*3)+3];
- int w = min (r, min(g, b));
- r = r- w;
- g = g - w;
- b = b - w;
- strip_nfc.setPixelColor(j, r, g, b, w);
- strip_nfc.show();
- }
- }
- if(inputBuffer[0] == 1){
- for (int j = 0; j < NUM_NFC+NUM_ACTIVATION; j++) {
- int r = inputBuffer[(j*3)+1];
- int g = inputBuffer[(j*3)+2];
- int b = inputBuffer[(j*3)+3];
- int w = min (r, min(g, b));
- r = r- w;
- g = g - w;
- b = b - w;
- strip_activation.setPixelColor(j, r, g, b, w);
- strip_activation.show();
- }
- }
- if(inputBuffer[0] == 2){
- for (int j = 0; j < NUM_NFC+NUM_PATHWAY1; j++) {
- int r = inputBuffer[(j*3)+1];
- int g = inputBuffer[(j*3)+2];
- int b = inputBuffer[(j*3)+3];
- int w = min (r, min(g, b));
- r = r- w;
- g = g - w;
- b = b - w;
- strip_pathway1.setPixelColor(j, r, g, b, w);
- strip_pathway1.show();
- }
- }
- if(inputBuffer[0] == 3){
- for (int j = 0; j < NUM_NFC+NUM_ELEVATOR; j++) {
- int r = inputBuffer[(j*3)+1];
- int g = inputBuffer[(j*3)+2];
- int b = inputBuffer[(j*3)+3];
- int w = min (r, min(g, b));
- r = r- w;
- g = g - w;
- b = b - w;
- strip_elevator.setPixelColor(j, r, g, b, w);
- strip_elevator.show();
- }
- }
- if(inputBuffer[0] == 4){
- for (int j = 0; j < NUM_NFC+NUM_CHASE; j++) {
- int r = inputBuffer[(j*3)+1];
- int g = inputBuffer[(j*3)+2];
- int b = inputBuffer[(j*3)+3];
- int w = min (r, min(g, b));
- r = r- w;
- g = g - w;
- b = b - w;
- strip_chase.setPixelColor(j, r, g, b, w);
- strip_chase.show();
- }
- }
- if(inputBuffer[0] == 5){
- for (int j = 0; j < NUM_NFC+NUM_PATHWAY2; j++) {
- int r = inputBuffer[(j*3)+1];
- int g = inputBuffer[(j*3)+2];
- int b = inputBuffer[(j*3)+3];
- int w = min (r, min(g, b));
- r = r- w;
- g = g - w;
- b = b - w;
- strip_pathway2.setPixelColor(j, r, g, b, w);
- strip_pathway2.show();
- }
- }
- if(inputBuffer[0] == 6){
- for (int j = 0; j < NUM_NFC+NUM_COLORIZER; j++) {
- int r = inputBuffer[(j*3)+1];
- int g = inputBuffer[(j*3)+2];
- int b = inputBuffer[(j*3)+3];
- int w = min (r, min(g, b));
- r = r- w;
- g = g - w;
- b = b - w;
- strip_colorizer.setPixelColor(j, r, g, b, w);
- strip_colorizer.show();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement