Código
Código Arduino Nano Arduino
Os códigos de tempo e animação estão nos arquivos #include #include #ifdef __AVR__ #include # endif # define PIN 6 # define PIN2 7 # define NUMPIXELS 60DS3231 rtc (SDA, SCL); Tempo t; int hr; int mnt; int sc; dados char; char color_select; int h_red_deger =255; int h_green_deger =0; int h_blue_deger =0; int m_red_deger =0; int m_green_deger =255; int m_blue_deger =0; int s_red_deger =255; int s_green_deger =255; int s_blue_deger =0; Adafruit_NeoPixel pixels =Adafruit_NeoPixel (NUMPIXELS, PIN, NEO_GRB + NEO_KH_Z800_Deger_KHZ800); Adafruit_NeoPixel pixels =Adafruit_NeoPixel (NUMPIXELS, PIN, NEO_GRB + NEO_KH_NeoPixa_Frix2HZ800); Adafruit_NeoPixel (NUMPIXELS, PIN, NEO_GRB + NEO_KH_NeoPixa_Frix2HZ800); =Adafruit_NeoPixel (60, PIN, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel strip2 =Adafruit_NeoPixel (12, PIN2, NEO_GRB + NEO_KHZ800); int delayval =10; void setup () {Serial.begin (9600); rtc.begin (); # se definido (__AVR_ATtiny85__) if (F_CPU ==16000000) clock_prescale_set (clock_div_1); # endif // Fim do código especial do trinket pixels.begin (); // Isso inicializa a biblioteca NeoPixel. pixels2.begin (); strip.begin (); strip.show (); strip2.begin (); strip2.show (); //} void loop () {while (Serial.available ()> 0) // balant kuruluyken {delay (10); char c =Serial.read (); dados =c; if (dados =='m') {dados =''; t =rtc.getTime (); hr =t.horas; mnt =t.min; sc =t.sec; enquanto (dados! ='m') {dados =Serial.read (); if (dados =='+') {hr ++; } if (data =='-') {hr--; } para (int i =0; i <12; i ++) {pixels2.setPixelColor (i, pixels2.Color (0,255,10));} pixels2.show (); if (hr> =12) {hr =hr-12;} if (hr <0) {hr =hr + 12;} pixels2.setPixelColor (hr, pixels2.Color (255,0,0)); pixels2.show (); atraso (100); pixels2.setPixelColor (hr, pixels2.Color (0,0,0)); pixels2.show (); atraso (100); } rtc.setTime (hr, mnt, sc); if (dados =='m') {dados =''; t =rtc.getTime (); hr =t.horas; mnt =t.min; sc =t.sec; enquanto (dados! ='m') {dados =Serial.read (); if (dados =='+') {mnt ++; if (mnt ==60) {mnt =0;}} if (data =='-') {if (mnt ==0) {mnt =60;} mnt--; } for (int k =0; k <60; k ++) {pixels.setPixelColor (k, pixels.Color (0,0,0));} for (int k =0; k <60; k ++) {pixels. setPixelColor (k, pixels.Color (25,25,255)); k =k + 4;} pixels.setPixelColor (mnt, pixels.Color (0,250,0)); pixels.show (); atraso (100); pixels.setPixelColor (mnt, pixels.Color (0,0,0)); pixels.show (); atraso (100); }} rtc.setTime (hr, mnt, sc); dados =''; } if (data =='H') {color_select =data; } if (data =='M') {color_select =data; } if (data =='S') {color_select =data; } if (data =='A') {data =''; colorWipe (strip.Color (255, 0, 0), 50); // Red colorWipe (strip.Color (0, 255, 0), 50); // Green colorWipe (strip.Color (0, 0, 255), 50); // Azul // colorWipe (strip.Color (0, 0, 0, 255), 50); // RGBW branco // Envia uma perseguição de pixel de teatro em ... theaterChase (strip.Color (127, 127, 127), 50); // White theaterChase (strip.Color (127, 0, 0), 50); // Red theaterChase (strip.Color (0, 0, 127), 50); // Arco-íris azul (20); rainbowCycle (20); theaterChaseRainbow (50); } if (data =='r' &&color_select =='H') {h_red_deger =Serial.parseInt (); pixels2.setPixelColor (hr, pixels2.Color (h_red_deger, h_green_deger, h_blue_deger)); pixels2.show (); } if (data =='g' &&color_select =='H') {h_green_deger =Serial.parseInt (); pixels2.setPixelColor (hr, pixels2.Color (h_red_deger, h_green_deger, h_blue_deger)); pixels2.show (); } if (data =='b' &&color_select =='H') {h_blue_deger =Serial.parseInt (); pixels2.setPixelColor (hr, pixels2.Color (h_red_deger, h_green_deger, h_blue_deger)); pixels2.show (); } if (data =='r' &&color_select =='M') {m_red_deger =Serial.parseInt (); pixels.setPixelColor (mnt, pixels.Color (m_red_deger, m_green_deger, m_blue_deger)); pixels.show (); } if (data =='g' &&color_select =='M') {m_green_deger =Serial.parseInt (); pixels.setPixelColor (mnt, pixels.Color (m_red_deger, m_green_deger, m_blue_deger)); pixels.show (); } if (data =='b' &&color_select =='M') {m_blue_deger =Serial.parseInt (); pixels.setPixelColor (mnt, pixels.Color (m_red_deger, m_green_deger, m_blue_deger)); pixels.show (); } if (data =='r' &&color_select =='S') {s_red_deger =Serial.parseInt (); pixels.setPixelColor (sc, pixels.Color (s_red_deger, s_green_deger, s_blue_deger)); pixels.show (); } if (data =='g' &&color_select =='S') {s_green_deger =Serial.parseInt (); pixels.setPixelColor (sc, pixels.Color (s_red_deger, s_green_deger, s_blue_deger)); pixels.show (); } if (data =='b' &&color_select =='S') {s_blue_deger =Serial.parseInt (); pixels.setPixelColor (sc, pixels.Color (s_red_deger, s_green_deger, s_blue_deger)); pixels.show (); }} t =rtc.getTime (); hr =t.horas; mnt =t.min; sc =t.sec; pixels.setPixelColor (sc, pixels.Color (s_red_deger, s_green_deger, s_blue_deger)); pixels.setPixelColor (mnt, pixels.Color (m_red_deger, m_green_deger, m_blue_deger)); pixels.show (); para (int i =0; i <12; i ++) {if (i ==hr) {i ++;} pixels2.setPixelColor (i, pixels2.Color (0,255,0));} pixels2.show (); if (hr> =12) {hr =hr-12;} pixels2.setPixelColor (hr, pixels2.Color (h_red_deger, h_green_deger, h_blue_deger)); pixels2.show (); atraso (10); pixels.setPixelColor (sc, pixels.Color (0,0,0)); for (int k =0; k <60; k ++) {pixels.setPixelColor (k, pixels.Color (0,0,0));} for (int k =0; k <60; k ++) {pixels.setPixelColor (k, pixels.Color (25,25,255)); k =k + 4;} pixels.setPixelColor (mnt, pixels.Color (0,0,0)); pixels.show (); } void colorWipe (uint32_t c, uint8_t wait) {for (uint16_t i =0; i