#include <Adafruit_NeoPixel.h>
#define INTERVAL_MESSAGE1 4000
#define INTERVAL_MESSAGE2 32000
#define PIN 2 // input pin Neopixel is attached to
#define NUMPIXELS 96 // number of neopixels in strip
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int delayval = 350; // timing delay in milliseconds
unsigned long time_1 = 0;
unsigned long time_2 = 0;
// 0 1 2 3 4 5 6
int redArray[8]={ 255, 212, 255, 0, 230, 0, 0, 0};
int greenArray[8]={ 0, 224, 60, 0, 0, 255, 0, 0};
int blueArray[8]={ 0, 240, 0, 255, 255, 0, 0, 0};
int GlassesRedArray[2]= { 55, 0};
int GlassesGreenArray[2] = { 90, 255};
int GlassesBlueArray[2] = { 255, 255};
int J = 0;
int t = 0;
int redColor = 0;
int greenColor = 0;
int blueColor = 0;
void setup() {
// Initialize the NeoPixel library.
Serial.begin(9600);
pixels.begin();
pinMode(3, INPUT);
}
void loop() {
redArray[5]= 0 ;
greenArray[5]= 255 ;
blueArray[5]= 0;
redArray[6]= 255;
greenArray[6]= 100 ;
blueArray[6]= 100;
redArray[7]= 255;
greenArray[7]= 255 ;
blueArray[7]= 0;
pixels.setPixelColor(2, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(3, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(4, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(10, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(11, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(12, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(13, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(14, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(17, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(18, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(19, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(20, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(21, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(29, pixels.Color(GlassesRedArray[J], GlassesGreenArray[J], GlassesBlueArray[J]));
pixels.setPixelColor(30, pixels.Color(GlassesRedArray[J], GlassesGreenArray[J], GlassesBlueArray[J]));
pixels.setPixelColor(31, pixels.Color(GlassesRedArray[J], GlassesGreenArray[J], GlassesBlueArray[J]));
pixels.setPixelColor(27, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(28, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(26, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(32, pixels.Color(GlassesRedArray[J], GlassesGreenArray[J], GlassesBlueArray[J]));
pixels.setPixelColor(33, pixels.Color(GlassesRedArray[J], GlassesGreenArray[J], GlassesBlueArray[J]));
pixels.setPixelColor(34, pixels.Color(GlassesRedArray[J], GlassesGreenArray[J], GlassesBlueArray[J]));
pixels.setPixelColor(35, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(36, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(37, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(38, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(39, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(45, pixels.Color(GlassesRedArray[J], GlassesGreenArray[J], GlassesBlueArray[J]));
pixels.setPixelColor(46, pixels.Color(GlassesRedArray[J], GlassesGreenArray[J], GlassesBlueArray[J]));
pixels.setPixelColor(47, pixels.Color(GlassesRedArray[J], GlassesGreenArray[J], GlassesBlueArray[J]));
pixels.setPixelColor(43, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(44, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(40, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(41, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(42, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(49, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(50, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(51, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(52, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(53, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(54, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(55, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(57, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(58, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(59, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(60, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(61, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(62, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(56, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(65, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(66, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(67, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(68, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(69, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(70, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(71, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.show();
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(2, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(3, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(4, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(10, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(11, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(12, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(13, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(14, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(17, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(18, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(19, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(20, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(21, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(29, pixels.Color(GlassesRedArray[J], GlassesGreenArray[J], GlassesBlueArray[J]));
pixels.setPixelColor(30, pixels.Color(GlassesRedArray[J], GlassesGreenArray[J], GlassesBlueArray[J]));
pixels.setPixelColor(31, pixels.Color(GlassesRedArray[J], GlassesGreenArray[J], GlassesBlueArray[J]));
pixels.setPixelColor(27, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(28, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(26, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(32, pixels.Color(GlassesRedArray[J], GlassesGreenArray[J], GlassesBlueArray[J]));
pixels.setPixelColor(33, pixels.Color(GlassesRedArray[J], GlassesGreenArray[J], GlassesBlueArray[J]));
pixels.setPixelColor(34, pixels.Color(GlassesRedArray[J], GlassesGreenArray[J], GlassesBlueArray[J]));
pixels.setPixelColor(35, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(36, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(37, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(38, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(39, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(45, pixels.Color(GlassesRedArray[J], GlassesGreenArray[J], GlassesBlueArray[J]));
pixels.setPixelColor(46, pixels.Color(GlassesRedArray[J], GlassesGreenArray[J], GlassesBlueArray[J]));
pixels.setPixelColor(47, pixels.Color(GlassesRedArray[J], GlassesGreenArray[J], GlassesBlueArray[J]));
pixels.setPixelColor(43, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(44, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(40, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(41, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(42, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(49, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(50, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(51, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(52, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(53, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(54, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(55, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(57, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(58, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(59, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(60, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(61, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(62, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(56, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(65, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(66, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(67, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(68, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(69, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(70, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(71, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.show();
pixels.setPixelColor(78, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(77, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(76, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(75, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(74, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(73, pixels.Color( 0, 0, 0));
pixels.setPixelColor(72, pixels.Color( 0, 0, 0));
pixels.setPixelColor(79, pixels.Color( 0, 0, 0));
pixels.setPixelColor(80, pixels.Color( 0, 0, 0));
pixels.setPixelColor(81, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(82, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(84, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(85, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(86, pixels.Color( 0, 0, 0));
pixels.setPixelColor(90, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(91, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(93, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(94, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.show();
delay(delayval);
pixels.setPixelColor(79, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(73, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(80, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(81, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(82, pixels.Color( 0, 0, 0));
pixels.setPixelColor(84, pixels.Color( 0, 0, 0));
pixels.setPixelColor(85, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(86, pixels.Color( redArray[t], greenArray[t], blueArray[t]));
pixels.setPixelColor(90, pixels.Color( 0, 0, 0));
pixels.setPixelColor(91, pixels.Color( 0, 0, 0));
pixels.setPixelColor(93, pixels.Color( 0, 0, 0));
pixels.setPixelColor(94, pixels.Color( 0, 0, 0));
// This sends the updated pixel color to the hardware.
pixels.show();
// Delay for a period of time (in milliseconds).
delay(delayval);
if(millis() > time_1 + INTERVAL_MESSAGE1){
t = t +1;
time_1 = millis();
}
if (millis() > time_2 + INTERVAL_MESSAGE2){
t= 0;
time_2 = millis();
}
Serial.println(t);
if(t==1){
J= 1;
}
if(t==2){
J=0;
}
}
Comments