Components and supplies
DC DC Converter Adjustable Step Down
NeoPixel strip
Wall frame RIBBA (Ikea)
Resistor 475 ohm
Pushbutton switch 12mm
Real Time Clock (RTC)
Arduino Nano R3
Standard LCD - 16x2 White on Blue
Resistor 10k ohm
1N4007 – High Voltage, High Current Rated Diode
aluminum strips 230 mm x 10 mm x 1mm
Gewiss box cover 150 x 110
Project description
Code
Italian WordClock
arduino
1/* 2:Project: WordClock 3:Author: Tiziano Bianchettin 4:Date: 25/09/2016 5:Revision: 1 6:License: Public Domain 7thanks to: 8 http://www.instructables.com/id/Javelins-Word-Clock/ 9 http://arduinoenonsolo.blogspot.it/2012/12/orologio-con-arduino-e-il-ds1307.html 10 http://www.mauroalfieri.it/ 11 http://www.danielealberti.it/ 12 http://www.maffucci.it/ 13 My electronics laboratory professor "Perito Carli" 14*/ 15//************libraries**************// 16#include <Wire.h> 17#include <RTClib.h> 18#include <LiquidCrystal_I2C.h> 19#include <Adafruit_NeoPixel.h> 20 21//***********neopixel****************// 22#define PIN 9 // pin neopixel 23#define NUM_LEDS 144 // 12 x 12 24#define GIORNO 255 // full on 25#define SERA 25 // a tenth on 26Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800); // 144 led, pin 9 27int intBrightness; 28 29//****************COLORS***********// 30uint32_t Red = strip.Color(255, 0, 0); 31uint32_t Green = strip.Color( 0, 255, 0); 32uint32_t Blue = strip.Color( 0, 0, 255); 33uint32_t White = strip.Color( 255, 255, 255); 34uint32_t Yellow = strip.Color( 255, 255, 0); 35uint32_t Purple = strip.Color( 60, 0, 255); 36uint32_t Off = strip.Color( 0, 0, 0); 37 38 39LiquidCrystal_I2C lcd(0x27,16,2); // Display I2C 16 x 2 40RTC_DS1307 RTC; 41int P1=6; // Button SET MENU' 42int P2=7; // Button + 43int P3=8; // Button - 44int oraagg; 45int minagg; 46int annoagg; 47int meseagg; 48int dayagg; 49int menu =0; 50int ora; 51 52 53//********Presentation*********// 54int txtSONO[] = {1,2,3,4,6,7,9,10,11,-1}; 55 56//********Hours*********// 57int txtUNA[] = {20,21,22,-1}; 58int txtDUE[] = {17,18,19,-1}; 59int txtTRE[] = {57,58,59,-1}; 60int txtQUATTRO[] = {96,97,98,99,100,101,102,-1}; 61int txtCINQUE[] = {30,31,32,33,34,35,-1}; 62int txtSEI[] = {103,104,105,-1}; 63int txtSETTE[] = {48,49,50,51,52,-1}; 64int txtOTTO[] = {72,73,74,75,-1}; 65int txtNOVE[] = {60,61,62,63,-1}; 66int txtDIECI[] = {12,13,14,15,16,-1}; 67int txtUNDICI[] = {84,85,86,87,88,89,-1}; 68int txtDODOCI[] = {90,91,92,93,94,95,-1}; 69 70//********Happy birthday*********// 71int txtAUGURI[] = {24,25,26,27,28,29,-1}; 72int txtSIMONE[] = {36,37,38,39,40,41,-1}; 73int txtJACOPO[] = {42,43,44,45,46,47,-1}; 74int txtMINU[] = {53,54,55,56,-1}; 75int txtTIZIANO[] = {65,66,67,68,69,70,71,-1}; 76int txtMARILENA[] = {76,77,78,79,80,81,82,83,-1}; 77 78//********Minutes*********// 79int txtE[] = {107,-1}; 80int txtMENO[] = {116,117,118,119,-1}; 81int txtMUNO[] = {5,-1}; 82int txtMDUE[] = {64,-1}; 83int txtMTRE[] = {106,-1}; 84int txtMQUATTRO[] = {125,-1}; 85int txtMCINQUE[] = {132,133,134,135,136,137,-1}; 86int txtMDIECI[] = {120,121,122,123,124,-1}; 87int txtQUINDICI[] = {108,109,110,111,112,113,114,115,-1}; 88int txtVENTI[] = {139,140,141,142,143,-1}; 89int txtTRENTA[] = {126,127,128,129,130,131,-1}; 90 91void setup() 92{ 93 94 strip.begin(); 95 strip.show(); 96 lcd.begin(); 97 lcd.backlight(); 98 lcd.clear(); 99 100 pinMode(P1,INPUT); 101 pinMode(P2,INPUT); 102 pinMode(P3,INPUT); 103 104 Serial.begin(9600); 105 Wire.begin(); 106 RTC.begin(); 107 108 if (! RTC.isrunning()) { 109 Serial.println("RTC is NOT running!"); 110 // Set the date and time at compile time 111 RTC.adjust(DateTime(__DATE__, __TIME__)); 112 } 113 // RTC.adjust(DateTime(__DATE__, __TIME__)); //removing "//" to adjust the time 114 // The default display shows the date and time 115 int menu=0; 116} 117 118void loop() 119{ 120 121// check if you press the SET button and increase the menu index 122 if(digitalRead(P1)) 123 { 124 menu=menu+1; 125 } 126// in which subroutine should we go? 127 if (menu==0) 128 { 129 DisplayDateTime(); // void DisplayDateTime 130 DateTime now = RTC.now(); 131 if((now.hour() >= 19) || (now.hour() < 7 )){ // adjust brightness day - night 132 intBrightness = SERA; 133 } 134 else{ 135 intBrightness = GIORNO; 136 } 137 strip.setBrightness(intBrightness); 138 strip.show(); 139 int timeMin = now.minute(); 140 int modMin = timeMin % 5; // https://www.arduino.cc/en/Reference/Modulo 141 if ( modMin == 0){ // every minute the LEDs change color and lights up the corresponding number 142 paintWord(txtSONO, White); 143 paintWord(txtMQUATTRO, OFF); 144 } 145 else if ( modMin == 1){ 146 paintWord(txtSONO, Yellow); 147 paintWord(txtMUNO, Red); 148 } 149 else if ( modMin == 2){ 150 paintWord(txtSONO, Green); 151 paintWord(txtMUNO, Off); 152 paintWord(txtMDUE, Blue); 153 } 154 else if ( modMin == 3){ 155 paintWord(txtSONO, Blue); 156 paintWord(txtMDUE, Off); 157 paintWord(txtMTRE, Green); 158 } 159 else if ( modMin == 4){ 160 paintWord(txtSONO, Red); 161 paintWord(txtMTRE, Off); 162 paintWord(txtMQUATTRO, Yellow); 163 } 164 165 HourClock(); //void HourClock 166 MinuteClock(); // void MinuteClock 167 Auguri(); // void Auguri 168 169 170 strip.show(); 171 } 172 if (menu==1) 173 { 174 DisplaySetHour(); 175 } 176 if (menu==2) 177 { 178 DisplaySetMinute(); 179 } 180 if (menu==3) 181 { 182 DisplaySetYear(); 183 } 184 if (menu==4) 185 { 186 DisplaySetMonth(); 187 } 188 if (menu==5) 189 { 190 DisplaySetDay(); 191 } 192 if (menu==6) 193 { 194 StoreAgg(); 195 delay(500); 196 menu=0; 197 } 198 delay(100); 199} 200void showStrip() { 201 #ifdef ADAFRUIT_NEOPIXEL_H 202 // NeoPixel 203 strip.show(); 204 #endif 205 #ifndef ADAFRUIT_NEOPIXEL_H 206 // FastLED 207 FastLED.show(); 208 #endif 209} 210 211void setPixel(int Pixel, byte red, byte green, byte blue) { 212 #ifdef ADAFRUIT_NEOPIXEL_H 213 // NeoPixel 214 strip.setPixelColor(Pixel, strip.Color(red, green, blue)); 215 #endif 216 #ifndef ADAFRUIT_NEOPIXEL_H 217 // FastLED 218 leds[Pixel].r = red; 219 leds[Pixel].g = green; 220 leds[Pixel].b = blue; 221 #endif 222} 223 224void setAll(byte red, byte green, byte blue) { 225 for(int i = 0; i < NUM_LEDS; i++ ) { 226 setPixel(i, red, green, blue); 227 } 228 showStrip(); 229} 230void Auguri(){ 231 DateTime now = RTC.now(); 232 if (now.month() == 11 && now.day() == 6){ //Jacopo 233 paintWord(txtAUGURI, Purple); 234 paintWord(txtJACOPO, Purple); 235 paintWord(txtSIMONE, Off); 236 paintWord(txtMINU, Off); 237 paintWord(txtTIZIANO, Off); 238 paintWord(txtMARILENA, Off); 239 } 240 else if (now.month() == 4 && now.day() == 25){ //Simone 241 paintWord(txtAUGURI, Purple); 242 paintWord(txtJACOPO, Off); 243 paintWord(txtSIMONE, Purple); 244 paintWord(txtMINU, Off); 245 paintWord(txtTIZIANO, Off); 246 paintWord(txtMARILENA, Off); 247 } 248 else if (now.month() == 6 && now.day() == 1){ //Minù 249 paintWord(txtAUGURI, Purple); 250 paintWord(txtJACOPO, Off); 251 paintWord(txtSIMONE, Off); 252 paintWord(txtMINU, Purple); 253 paintWord(txtTIZIANO, Off); 254 paintWord(txtMARILENA, Off); 255 } 256 else if (now.month() == 4 && now.day() == 24){ //Tiziano 257 paintWord(txtAUGURI, Purple); 258 paintWord(txtJACOPO, Off); 259 paintWord(txtSIMONE, Off); 260 paintWord(txtMINU, Off); 261 paintWord(txtTIZIANO, Purple); 262 paintWord(txtMARILENA, Off); 263 } 264 else if (now.month() == 6 && now.day() == 22){ //Marilena 265 paintWord(txtAUGURI, Purple); 266 paintWord(txtJACOPO, Off); 267 paintWord(txtSIMONE, Off); 268 paintWord(txtMINU, Off); 269 paintWord(txtTIZIANO, Off); 270 paintWord(txtMARILENA, Purple); 271 } 272 else{ 273 paintWord(txtAUGURI, Off); 274 paintWord(txtJACOPO, Off); 275 paintWord(txtSIMONE, Off); 276 paintWord(txtMINU, Off); 277 paintWord(txtTIZIANO, Off); 278 paintWord(txtMARILENA, Off); 279 } 280} 281void DisplayDateTime () 282{ 283// We show the current date and time 284 DateTime now = RTC.now(); 285 286 lcd.setCursor(0, 1); 287 lcd.print("Ora:"); 288 if (now.hour()<=9) 289 { 290 lcd.print("0"); 291 } 292 lcd.print(now.hour(), DEC); 293 oraagg=now.hour(); 294 lcd.print(":"); 295 if (now.minute()<=9) 296 { 297 lcd.print("0"); 298 } 299 lcd.print(now.minute(), DEC); 300 minagg=now.minute(); 301 lcd.print(":"); 302 if (now.second()<=9) 303 { 304 lcd.print("0"); 305 } 306 lcd.print(now.second(), DEC); 307 308 lcd.setCursor(0, 0); 309 lcd.print("Data: "); 310 if (now.day()<=9) 311 { 312 lcd.print("0"); 313 } 314 lcd.print(now.day(), DEC); 315 dayagg=now.day(); 316 lcd.print("/"); 317 if (now.month()<=9) 318 { 319 lcd.print("0"); 320 } 321 lcd.print(now.month(), DEC); 322 meseagg=now.month(); 323 lcd.print("/"); 324 lcd.print(now.year(), DEC); 325 annoagg=now.year(); 326} 327 328void DisplaySetHour() 329{ 330// time setting 331 lcd.clear(); 332 DateTime now = RTC.now(); 333 if(digitalRead(P2)==HIGH) 334 { 335 if(oraagg==23) 336 { 337 oraagg=0; 338 } 339 else 340 { 341 oraagg=oraagg+1; 342 } 343 } 344 if(digitalRead(P3)==HIGH) 345 { 346 if(oraagg==0) 347 { 348 oraagg=23; 349 } 350 else 351 { 352 oraagg=oraagg-1; 353 } 354 } 355 lcd.setCursor(0,0); 356 lcd.print("Imposta Ora:"); 357 lcd.setCursor(0,1); 358 lcd.print(oraagg,DEC); 359 delay(200); 360} 361 362void DisplaySetMinute() 363{ 364// Setting the minutes 365 lcd.clear(); 366 if(digitalRead(P2)==HIGH) 367 { 368 if (minagg==59) 369 { 370 minagg=0; 371 } 372 else 373 { 374 minagg=minagg+1; 375 } 376 } 377 if(digitalRead(P3)==HIGH) 378 { 379 if (minagg==0) 380 { 381 minagg=59; 382 } 383 else 384 { 385 minagg=minagg-1; 386 } 387 } 388 lcd.setCursor(0,0); 389 lcd.print("Imposta Minuti:"); 390 lcd.setCursor(0,1); 391 lcd.print(minagg,DEC); 392 delay(200); 393} 394 395void DisplaySetYear() 396{ 397// setting the year 398 lcd.clear(); 399 if(digitalRead(P2)==HIGH) 400 { 401 annoagg=annoagg+1; 402 } 403 if(digitalRead(P3)==HIGH) 404 { 405 annoagg=annoagg-1; 406 } 407 lcd.setCursor(0,0); 408 lcd.print("Imposta Anno:"); 409 lcd.setCursor(0,1); 410 lcd.print(annoagg,DEC); 411 delay(200); 412} 413 414void DisplaySetMonth() 415{ 416// Setting the month 417 lcd.clear(); 418 if(digitalRead(P2)==HIGH) 419 { 420 if (meseagg==12) 421 { 422 meseagg=1; 423 } 424 else 425 { 426 meseagg=meseagg+1; 427 } 428 } 429 if(digitalRead(P3)==HIGH) 430 { 431 if (meseagg==1) 432 { 433 meseagg=12; 434 } 435 else 436 { 437 meseagg=meseagg-1; 438 } 439 } 440 lcd.setCursor(0,0); 441 lcd.print("Imposta Mese:"); 442 lcd.setCursor(0,1); 443 lcd.print(meseagg,DEC); 444 delay(200); 445} 446 447void DisplaySetDay() 448{ 449// Setting the day 450 lcd.clear(); 451 if(digitalRead(P2)==HIGH) 452 { 453 if (dayagg==31) 454 { 455 dayagg=1; 456 } 457 else 458 { 459 dayagg=dayagg+1; 460 } 461 } 462 if(digitalRead(P3)==HIGH) 463 { 464 if (dayagg==1) 465 { 466 dayagg=31; 467 } 468 else 469 { 470 dayagg=dayagg-1; 471 } 472 } 473 lcd.setCursor(0,0); 474 lcd.print("Imposta Giorno:"); 475 lcd.setCursor(0,1); 476 lcd.print(dayagg,DEC); 477 delay(200); 478} 479 480void StoreAgg() 481{ 482// Variable saving 483 lcd.clear(); 484 lcd.setCursor(0,0); 485 lcd.print("SALVATAGGIO IN"); 486 lcd.setCursor(0,1); 487 lcd.print("CORSO"); 488 RTC.adjust(DateTime(annoagg,meseagg,dayagg,oraagg,minagg,0)); 489 delay(200); 490} 491void HourClock() 492{ 493 DateTime now = RTC.now(); 494 int timeMin = now.minute(); 495 int modMin = timeMin % 5; // https://www.arduino.cc/en/Reference/Modulo 496 int ora = now.hour() ; 497 if ( timeMin >= 40){ // from the 40 minutes, add 1 to "hour" 498 ora = ora+1 ; 499 } 500 switch (ora ) { 501 case 0: 502 case 12: 503 case 24: 504 paintWord(txtUNDICI, Off); 505 strip.show(); 506 if ( modMin == 0){ 507 paintWord(txtDODOCI, White); 508 strip.show(); 509 } 510 else if ( modMin == 1){ 511 paintWord(txtDODOCI, Yellow); 512 strip.show(); 513 } 514 else if ( modMin == 2){ 515 paintWord(txtDODOCI, Green); 516 strip.show(); 517 } 518 else if ( modMin == 3){ 519 paintWord(txtDODOCI, Blue); 520 strip.show(); 521 } 522 else if ( modMin == 4){ 523 paintWord(txtDODOCI, Red); 524 strip.show(); 525 } 526 527break; 528 case 1: 529 case 13: 530 paintWord(txtDODOCI, Off); 531 strip.show(); 532 533 if ( modMin == 0){ 534 paintWord(txtUNA, White); 535 strip.show(); 536 } 537 else if ( modMin == 1){ 538 paintWord(txtUNA, Yellow); 539 strip.show(); 540 } 541 else if ( modMin == 2){ 542 paintWord(txtUNA, Green); 543 strip.show(); 544 } 545 else if ( modMin == 3){ 546 paintWord(txtUNA, Blue); 547 strip.show(); 548 } 549 else if ( modMin == 4){ 550 paintWord(txtUNA, Red); 551 strip.show(); 552 } 553 554 555break; 556 case 2: 557 case 14: 558 paintWord(txtUNA, Off); 559 strip.show(); 560 561 if ( modMin == 0){ 562 paintWord(txtDUE, White); 563 strip.show(); 564 } 565 else if ( modMin == 1){ 566 paintWord(txtDUE, Yellow); 567 strip.show(); 568 } 569 else if ( modMin == 2){ 570 paintWord(txtDUE, Green); 571 strip.show(); 572 } 573 else if ( modMin == 3){ 574 paintWord(txtDUE, Blue); 575 strip.show(); 576 } 577 else if ( modMin == 4){ 578 paintWord(txtDUE, Red); 579 strip.show(); 580 } 581break; 582 case 3: 583 case 15: 584 585 paintWord(txtDUE, Off); 586 strip.show(); 587 588 if ( modMin == 0){ 589 paintWord(txtTRE, White); 590 strip.show(); 591 } 592 else if ( modMin == 1){ 593 paintWord(txtTRE, Yellow); 594 strip.show(); 595 } 596 else if ( modMin == 2){ 597 paintWord(txtTRE, Green); 598 strip.show(); 599 } 600 else if ( modMin == 3){ 601 paintWord(txtTRE, Blue); 602 strip.show(); 603 } 604 else if ( modMin == 4){ 605 paintWord(txtTRE, Red); 606 strip.show(); 607 } 608 609break; 610 case 4: 611 case 16: 612 613 paintWord(txtTRE, Off); 614 strip.show(); 615 616 if ( modMin == 0){ 617 paintWord(txtQUATTRO, White); 618 strip.show(); 619 } 620 else if ( modMin == 1){ 621 paintWord(txtQUATTRO, Yellow); 622 strip.show(); 623 } 624 else if ( modMin == 2){ 625 paintWord(txtQUATTRO, Green); 626 strip.show(); 627 } 628 else if ( modMin == 3){ 629 paintWord(txtQUATTRO, Blue); 630 strip.show(); 631 } 632 else if ( modMin == 4){ 633 paintWord(txtQUATTRO, Red); 634 strip.show(); 635 } 636 637break; 638 case 5: 639 case 17: 640 641 paintWord(txtQUATTRO, Off); 642 strip.show(); 643 644 if ( modMin == 0){ 645 paintWord(txtCINQUE, White); 646 strip.show(); 647 } 648 else if ( modMin == 1){ 649 paintWord(txtCINQUE, Yellow); 650 strip.show(); 651 } 652 else if ( modMin == 2){ 653 paintWord(txtCINQUE, Green); 654 strip.show(); 655 } 656 else if ( modMin == 3){ 657 paintWord(txtCINQUE, Blue); 658 strip.show(); 659 } 660 else if ( modMin == 4){ 661 paintWord(txtCINQUE, Red); 662 strip.show(); 663 } 664 665break; 666 case 6: 667 case 18: 668 669 paintWord(txtCINQUE, Off); 670 strip.show(); 671 672 if ( modMin == 0){ 673 paintWord(txtSEI, White); 674 strip.show(); 675 } 676 else if ( modMin == 1){ 677 paintWord(txtSEI, Yellow); 678 strip.show(); 679 } 680 else if ( modMin == 2){ 681 paintWord(txtSEI, Green); 682 strip.show(); 683 } 684 else if ( modMin == 3){ 685 paintWord(txtSEI, Blue); 686 strip.show(); 687 } 688 else if ( modMin == 4){ 689 paintWord(txtSEI, Red); 690 strip.show(); 691 } 692 693break; 694 case 7: 695 case 19: 696 697 paintWord(txtSEI, Off); 698 strip.show(); 699 700 if ( modMin == 0){ 701 paintWord(txtSETTE, White); 702 strip.show(); 703 } 704 else if ( modMin == 1){ 705 paintWord(txtSETTE, Yellow); 706 strip.show(); 707 } 708 else if ( modMin == 2){ 709 paintWord(txtSETTE, Green); 710 strip.show(); 711 } 712 else if ( modMin == 3){ 713 paintWord(txtSETTE, Blue); 714 strip.show(); 715 } 716 else if ( modMin == 4){ 717 paintWord(txtSETTE, Red); 718 strip.show(); 719 } 720 721break; 722 case 8: 723 case 20: 724 725 paintWord(txtSETTE, Off); 726 strip.show(); 727 728 if ( modMin == 0){ 729 paintWord(txtOTTO, White); 730 strip.show(); 731 } 732 else if ( modMin == 1){ 733 paintWord(txtOTTO, Yellow); 734 strip.show(); 735 } 736 else if ( modMin == 2){ 737 paintWord(txtOTTO, Green); 738 strip.show(); 739 } 740 else if ( modMin == 3){ 741 paintWord(txtOTTO, Blue); 742 strip.show(); 743 } 744 else if ( modMin == 4){ 745 paintWord(txtOTTO, Red); 746 strip.show(); 747 } 748 749break; 750 case 9: 751 case 21: 752 753 paintWord(txtOTTO, Off); 754 strip.show(); 755 756 if ( modMin == 0){ 757 paintWord(txtNOVE, White); 758 strip.show(); 759 } 760 else if ( modMin == 1){ 761 paintWord(txtNOVE, Yellow); 762 strip.show(); 763 } 764 else if ( modMin == 2){ 765 paintWord(txtNOVE, Green); 766 strip.show(); 767 } 768 else if ( modMin == 3){ 769 paintWord(txtNOVE, Blue); 770 strip.show(); 771 } 772 else if ( modMin == 4){ 773 paintWord(txtNOVE, Red); 774 strip.show(); 775 } 776 777break; 778 case 10: 779 case 22: 780 781 paintWord(txtNOVE, Off); 782 strip.show(); 783 784 if ( modMin == 0){ 785 paintWord(txtDIECI, White); 786 strip.show(); 787 } 788 else if ( modMin == 1){ 789 paintWord(txtDIECI, Yellow); 790 strip.show(); 791 } 792 else if ( modMin == 2){ 793 paintWord(txtDIECI, Green); 794 strip.show(); 795 } 796 else if ( modMin == 3){ 797 paintWord(txtDIECI, Blue); 798 strip.show(); 799 } 800 else if ( modMin == 4){ 801 paintWord(txtDIECI, Red); 802 strip.show(); 803 } 804 805break; 806 case 11: 807 case 23: 808 809 paintWord(txtDIECI, Off); 810 strip.show(); 811 812 if ( modMin == 0){ 813 paintWord(txtUNDICI, White); 814 strip.show(); 815 } 816 else if ( modMin == 1){ 817 paintWord(txtUNDICI, Yellow); 818 strip.show(); 819 } 820 else if ( modMin == 2){ 821 paintWord(txtUNDICI, Green); 822 strip.show(); 823 } 824 else if ( modMin == 3){ 825 paintWord(txtUNDICI, Blue); 826 strip.show(); 827 } 828 else if ( modMin == 4){ 829 paintWord(txtUNDICI, Red); 830 strip.show(); 831 } 832break; 833 } 834} 835void MinuteClock() 836{ 837 DateTime now = RTC.now(); 838 int timeMin = now.minute(); 839 int modMin = timeMin % 5; // https://www.arduino.cc/en/Reference/Modulo 840 switch (now.minute()) { 841 case 5: 842 case 6: 843 case 7: 844 case 8: 845 case 9: 846 847 if ( modMin == 0){ 848 paintWord(txtE, White); 849 paintWord(txtMCINQUE, White); 850 strip.show(); 851 } 852 else if ( modMin == 1){ 853 paintWord(txtE, Yellow); 854 paintWord(txtMCINQUE, Yellow); 855 strip.show(); 856 } 857 else if ( modMin == 2){ 858 paintWord(txtE, Green); 859 paintWord(txtMCINQUE, Green); 860 strip.show(); 861 } 862 else if ( modMin == 3){ 863 paintWord(txtE, Blue); 864 paintWord(txtMCINQUE, Blue); 865 strip.show(); 866 } 867 else if ( modMin == 4){ 868 paintWord(txtE, Red); 869 paintWord(txtMCINQUE, Red); 870 strip.show(); 871 } 872break; 873 874 875 case 10: 876 case 11: 877 case 12: 878 case 13: 879 case 14: 880 paintWord(txtMCINQUE, Off); 881 strip.show(); 882 if ( modMin == 0){ 883 paintWord(txtE, White); 884 paintWord(txtMDIECI, White); 885 strip.show(); 886 } 887 else if ( modMin == 1){ 888 paintWord(txtE, Yellow); 889 paintWord(txtMDIECI, Yellow); 890 strip.show(); 891 } 892 else if ( modMin == 2){ 893 paintWord(txtE, Green); 894 paintWord(txtMDIECI, Green); 895 strip.show(); 896 } 897 else if ( modMin == 3){ 898 paintWord(txtE, Blue); 899 paintWord(txtMDIECI, Blue); 900 strip.show(); 901 } 902 else if ( modMin == 4){ 903 paintWord(txtE, Red); 904 paintWord(txtMDIECI, Red); 905 strip.show(); 906 } 907 908break; 909 910 case 15: 911 case 16: 912 case 17: 913 case 18: 914 case 19: 915 paintWord(txtMDIECI, Off); 916 strip.show(); 917 if ( modMin == 0){ 918 paintWord(txtE, White); 919 paintWord(txtQUINDICI, White); 920 strip.show(); 921 } 922 else if ( modMin == 1){ 923 paintWord(txtE, Yellow); 924 paintWord(txtQUINDICI, Yellow); 925 strip.show(); 926 } 927 else if ( modMin == 2){ 928 paintWord(txtE, Green); 929 paintWord(txtQUINDICI, Green); 930 strip.show(); 931 } 932 else if ( modMin == 3){ 933 paintWord(txtE, Blue); 934 paintWord(txtQUINDICI, Blue); 935 strip.show(); 936 } 937 else if ( modMin == 4){ 938 paintWord(txtE, Red); 939 paintWord(txtQUINDICI, Red); 940 strip.show(); 941 } 942break; 943 944 945 case 20: 946 case 21: 947 case 22: 948 case 23: 949 case 24: 950 paintWord(txtQUINDICI, Off); 951 strip.show(); 952 if ( modMin == 0){ 953 paintWord(txtE, White); 954 paintWord(txtVENTI, White); 955 strip.show(); 956 } 957 else if ( modMin == 1){ 958 paintWord(txtE, Yellow); 959 paintWord(txtVENTI, Yellow); 960 strip.show(); 961 } 962 else if ( modMin == 2){ 963 paintWord(txtE, Green); 964 paintWord(txtVENTI, Green); 965 strip.show(); 966 } 967 else if ( modMin == 3){ 968 paintWord(txtE, Blue); 969 paintWord(txtVENTI, Blue); 970 strip.show(); 971 } 972 else if ( modMin == 4){ 973 paintWord(txtE, Red); 974 paintWord(txtVENTI, Red); 975 strip.show(); 976 } 977break; 978 979 case 25: 980 case 26: 981 case 27: 982 case 28: 983 case 29: 984 985 if ( modMin == 0){ 986 paintWord(txtE, White); 987 paintWord(txtVENTI, White); 988 paintWord(txtMCINQUE, White); 989 strip.show(); 990 } 991 else if ( modMin == 1){ 992 paintWord(txtE, Yellow); 993 paintWord(txtVENTI, Yellow); 994 paintWord(txtMCINQUE, Yellow); 995 strip.show(); 996 } 997 else if ( modMin == 2){ 998 paintWord(txtE, Green); 999 paintWord(txtVENTI, Green); 1000 paintWord(txtMCINQUE, Green); 1001 strip.show(); 1002 } 1003 else if ( modMin == 3){ 1004 paintWord(txtE, Blue); 1005 paintWord(txtVENTI, Blue); 1006 paintWord(txtMCINQUE, Blue); 1007 strip.show(); 1008 } 1009 else if ( modMin == 4){ 1010 paintWord(txtE, Red); 1011 paintWord(txtVENTI, Red); 1012 paintWord(txtMCINQUE, Red); 1013 strip.show(); 1014 } 1015break; 1016 1017 case 30: 1018 case 31: 1019 case 32: 1020 case 33: 1021 case 34: 1022 paintWord(txtVENTI, Off); 1023 paintWord(txtMCINQUE, Off); 1024 strip.show(); 1025 if ( modMin == 0){ 1026 paintWord(txtE, White); 1027 paintWord(txtTRENTA, White); 1028 strip.show(); 1029 } 1030 else if ( modMin == 1){ 1031 paintWord(txtE, Yellow); 1032 paintWord(txtTRENTA, Yellow); 1033 strip.show(); 1034 } 1035 else if ( modMin == 2){ 1036 paintWord(txtE, Green); 1037 paintWord(txtTRENTA, Green); 1038 strip.show(); 1039 } 1040 else if ( modMin == 3){ 1041 paintWord(txtE, Blue); 1042 paintWord(txtTRENTA, Blue); 1043 strip.show(); 1044 } 1045 else if ( modMin == 4){ 1046 paintWord(txtE, Red); 1047 paintWord(txtTRENTA, Red); 1048 strip.show(); 1049 } 1050break; 1051 1052 case 35: 1053 case 36: 1054 case 37: 1055 case 38: 1056 case 39: 1057 if ( modMin == 0){ 1058 paintWord(txtE, White); 1059 paintWord(txtTRENTA, White); 1060 paintWord(txtMCINQUE, White); 1061 strip.show(); 1062 } 1063 else if ( modMin == 1){ 1064 paintWord(txtE, Yellow); 1065 paintWord(txtTRENTA, Yellow); 1066 paintWord(txtMCINQUE, Yellow); 1067 strip.show(); 1068 } 1069 else if ( modMin == 2){ 1070 paintWord(txtE, Green); 1071 paintWord(txtTRENTA, Green); 1072 paintWord(txtMCINQUE, Green); 1073 strip.show(); 1074 } 1075 else if ( modMin == 3){ 1076 paintWord(txtE, Blue); 1077 paintWord(txtTRENTA, Blue); 1078 paintWord(txtMCINQUE, Blue); 1079 strip.show(); 1080 } 1081 else if ( modMin == 4){ 1082 paintWord(txtE, Red); 1083 paintWord(txtTRENTA, Red); 1084 paintWord(txtMCINQUE, Red); 1085 strip.show(); 1086 } 1087break; 1088 1089 case 40: 1090 case 41: 1091 case 42: 1092 case 43: 1093 case 44: 1094 paintWord(txtE, Off); 1095 paintWord(txtTRENTA, Off); 1096 paintWord(txtMCINQUE, Off); 1097 strip.show(); 1098 if ( modMin == 0){ 1099 paintWord(txtMENO, White); //from the 40 minutes, add 1 to "now" and Printing "meno" 1100 paintWord(txtVENTI, White); 1101 strip.show(); 1102 } 1103 else if ( modMin == 1){ 1104 paintWord(txtMENO, Yellow); 1105 paintWord(txtVENTI, Yellow); 1106 strip.show(); 1107 } 1108 else if ( modMin == 2){ 1109 paintWord(txtMENO, Green); 1110 paintWord(txtVENTI, Green); 1111 strip.show(); 1112 } 1113 else if ( modMin == 3){ 1114 paintWord(txtMENO, Blue); 1115 paintWord(txtVENTI, Blue); 1116 strip.show(); 1117 } 1118 else if ( modMin == 4){ 1119 paintWord(txtMENO, Red); 1120 paintWord(txtVENTI, Red); 1121 strip.show(); 1122 } 1123break; 1124 1125 case 45: 1126 case 46: 1127 case 47: 1128 case 48: 1129 case 49: 1130 paintWord(txtVENTI, Off); 1131 strip.show(); 1132 if ( modMin == 0){ 1133 paintWord(txtMENO, White); 1134 paintWord(txtQUINDICI, White); 1135 strip.show(); 1136 } 1137 else if ( modMin == 1){ 1138 paintWord(txtMENO, Yellow); 1139 paintWord(txtQUINDICI, Yellow); 1140 strip.show(); 1141 } 1142 else if ( modMin == 2){ 1143 paintWord(txtMENO, Green); 1144 paintWord(txtQUINDICI, Green); 1145 strip.show(); 1146 } 1147 else if ( modMin == 3){ 1148 paintWord(txtMENO, Blue); 1149 paintWord(txtQUINDICI, Blue); 1150 strip.show(); 1151 } 1152 else if ( modMin == 4){ 1153 paintWord(txtMENO, Red); 1154 paintWord(txtQUINDICI, Red); 1155 strip.show(); 1156 } 1157break; 1158 1159 case 50: 1160 case 51: 1161 case 52: 1162 case 53: 1163 case 54: 1164 paintWord(txtQUINDICI, Off); 1165 strip.show(); 1166 if ( modMin == 0){ 1167 paintWord(txtMENO, White); 1168 paintWord(txtMDIECI, White); 1169 strip.show(); 1170 } 1171 else if ( modMin == 1){ 1172 paintWord(txtMENO, Yellow); 1173 paintWord(txtMDIECI, Yellow); 1174 strip.show(); 1175 } 1176 else if ( modMin == 2){ 1177 paintWord(txtMENO, Green); 1178 paintWord(txtMDIECI, Green); 1179 strip.show(); 1180 } 1181 else if ( modMin == 3){ 1182 paintWord(txtMENO, Blue); 1183 paintWord(txtMDIECI, Blue); 1184 strip.show(); 1185 } 1186 else if ( modMin == 4){ 1187 paintWord(txtMENO, Red); 1188 paintWord(txtMDIECI, Red); 1189 strip.show(); 1190 } 1191break; 1192 1193 case 55: 1194 case 56: 1195 case 57: 1196 case 58: 1197 case 59: 1198 1199 paintWord(txtMDIECI, Off); 1200 strip.show(); 1201 if ( modMin == 0){ 1202 paintWord(txtMENO, White); 1203 paintWord(txtMCINQUE, White); 1204 strip.show(); 1205 } 1206 else if ( modMin == 1){ 1207 paintWord(txtMENO, Yellow); 1208 paintWord(txtMCINQUE, Yellow); 1209 strip.show(); 1210 } 1211 else if ( modMin == 2){ 1212 paintWord(txtMENO, Green); 1213 paintWord(txtMCINQUE, Green); 1214 strip.show(); 1215 } 1216 else if ( modMin == 3){ 1217 paintWord(txtMENO, Blue); 1218 paintWord(txtMCINQUE, Blue); 1219 strip.show(); 1220 } 1221 else if ( modMin == 4){ 1222 paintWord(txtMENO, Red); 1223 paintWord(txtMCINQUE, Red); 1224 strip.show(); 1225 } 1226break; 1227 1228 case 0: 1229 case 1: 1230 case 2: 1231 case 3: 1232 case 4: 1233 paintWord(txtMENO, Off); 1234 paintWord(txtMCINQUE, Off); 1235 strip.show(); 1236break; 1237 } 1238} 1239void paintWord(int arrWord[], uint32_t intColor){ 1240 for(int i = 0; i < strip.numPixels() + 1; i++){ 1241 if(arrWord[i] == -1){ 1242 strip.show(); 1243 break; 1244 } 1245 else{ 1246 strip.setPixelColor(arrWord[i],intColor); 1247 } 1248 } 1249}
Italian WordClock
arduino
1/* 2:Project: WordClock 3:Author: Tiziano Bianchettin 4:Date: 25/09/2016 5:Revision: 6 1 7:License: Public Domain 8thanks to: 9 http://www.instructables.com/id/Javelins-Word-Clock/ 10 11 http://arduinoenonsolo.blogspot.it/2012/12/orologio-con-arduino-e-il-ds1307.html 12 13 http://www.mauroalfieri.it/ 14 http://www.danielealberti.it/ 15 http://www.maffucci.it/ 16 17 My electronics laboratory professor "Perito Carli" 18*/ 19//************libraries**************// 20#include 21 <Wire.h> 22#include <RTClib.h> 23#include <LiquidCrystal_I2C.h> 24#include <Adafruit_NeoPixel.h> 25 26//***********neopixel****************// 27#define 28 PIN 9 // pin neopixel 29#define NUM_LEDS 144 // 12 x 12 30#define GIORNO 31 255 // full on 32#define SERA 25 // a tenth on 33Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, 34 PIN, NEO_GRB + NEO_KHZ800); // 144 led, pin 9 35int intBrightness; 36 37//****************COLORS***********// 38uint32_t 39 Red = strip.Color(255, 0, 0); 40uint32_t Green = strip.Color( 0, 255, 0); 41uint32_t 42 Blue = strip.Color( 0, 0, 255); 43uint32_t White = strip.Color( 255, 255, 255); 44uint32_t 45 Yellow = strip.Color( 255, 255, 0); 46uint32_t Purple = strip.Color( 60, 0, 255); 47uint32_t 48 Off = strip.Color( 0, 0, 0); 49 50 51LiquidCrystal_I2C lcd(0x27,16,2); // Display 52 I2C 16 x 2 53RTC_DS1307 RTC; 54int P1=6; // Button SET MENU' 55int P2=7; // 56 Button + 57int P3=8; // Button - 58int oraagg; 59int minagg; 60int annoagg; 61int 62 meseagg; 63int dayagg; 64int menu =0; 65int ora; 66 67 68//********Presentation*********// 69int 70 txtSONO[] = {1,2,3,4,6,7,9,10,11,-1}; 71 72//********Hours*********// 73int 74 txtUNA[] = {20,21,22,-1}; 75int txtDUE[] = {17,18,19,-1}; 76int txtTRE[] = 77 {57,58,59,-1}; 78int txtQUATTRO[] = {96,97,98,99,100,101,102,-1}; 79int txtCINQUE[] 80 = {30,31,32,33,34,35,-1}; 81int txtSEI[] = {103,104,105,-1}; 82int txtSETTE[] 83 = {48,49,50,51,52,-1}; 84int txtOTTO[] = {72,73,74,75,-1}; 85int txtNOVE[] = 86 {60,61,62,63,-1}; 87int txtDIECI[] = {12,13,14,15,16,-1}; 88int txtUNDICI[] 89 = {84,85,86,87,88,89,-1}; 90int txtDODOCI[] = {90,91,92,93,94,95,-1}; 91 92//********Happy 93 birthday*********// 94int txtAUGURI[] = {24,25,26,27,28,29,-1}; 95int txtSIMONE[] 96 = {36,37,38,39,40,41,-1}; 97int txtJACOPO[] = {42,43,44,45,46,47,-1}; 98int txtMINU[] 99 = {53,54,55,56,-1}; 100int txtTIZIANO[] = {65,66,67,68,69,70,71,-1}; 101int txtMARILENA[] 102 = {76,77,78,79,80,81,82,83,-1}; 103 104//********Minutes*********// 105int txtE[] 106 = {107,-1}; 107int txtMENO[] = {116,117,118,119,-1}; 108int txtMUNO[] = {5,-1}; 109int 110 txtMDUE[] = {64,-1}; 111int txtMTRE[] = {106,-1}; 112int txtMQUATTRO[] = {125,-1}; 113int 114 txtMCINQUE[] = {132,133,134,135,136,137,-1}; 115int txtMDIECI[] = {120,121,122,123,124,-1}; 116int 117 txtQUINDICI[] = {108,109,110,111,112,113,114,115,-1}; 118int txtVENTI[] = {139,140,141,142,143,-1}; 119int 120 txtTRENTA[] = {126,127,128,129,130,131,-1}; 121 122void setup() 123{ 124 125 strip.begin(); 126 127 strip.show(); 128 lcd.begin(); 129 lcd.backlight(); 130 lcd.clear(); 131 132 133 pinMode(P1,INPUT); 134 pinMode(P2,INPUT); 135 pinMode(P3,INPUT); 136 137 Serial.begin(9600); 138 139 Wire.begin(); 140 RTC.begin(); 141 142 if (! RTC.isrunning()) { 143 Serial.println("RTC 144 is NOT running!"); 145 // Set the date and time at compile time 146 RTC.adjust(DateTime(__DATE__, 147 __TIME__)); 148 } 149 // RTC.adjust(DateTime(__DATE__, __TIME__)); //removing 150 "//" to adjust the time 151 // The default display shows the date and time 152 153 int menu=0; 154} 155 156void loop() 157{ 158 159// check if you press the SET 160 button and increase the menu index 161 if(digitalRead(P1)) 162 { 163 menu=menu+1; 164 165 } 166// in which subroutine should we go? 167 if (menu==0) 168 { 169 DisplayDateTime(); 170 // void DisplayDateTime 171 DateTime now = RTC.now(); 172 if((now.hour() 173 >= 19) || (now.hour() < 7 )){ // adjust brightness day - night 174 intBrightness 175 = SERA; 176 } 177 else{ 178 intBrightness = GIORNO; 179 } 180 181 strip.setBrightness(intBrightness); 182 strip.show(); 183 int timeMin 184 = now.minute(); 185 int modMin = timeMin % 5; // https://www.arduino.cc/en/Reference/Modulo 186 187 if ( modMin == 0){ // every minute the LEDs change color and lights up the 188 corresponding number 189 paintWord(txtSONO, White); 190 paintWord(txtMQUATTRO, 191 OFF); 192 } 193 else if ( modMin == 1){ 194 paintWord(txtSONO, 195 Yellow); 196 paintWord(txtMUNO, Red); 197 } 198 else if ( modMin 199 == 2){ 200 paintWord(txtSONO, Green); 201 paintWord(txtMUNO, Off); 202 203 paintWord(txtMDUE, Blue); 204 } 205 else if ( modMin == 3){ 206 207 paintWord(txtSONO, Blue); 208 paintWord(txtMDUE, Off); 209 paintWord(txtMTRE, 210 Green); 211 } 212 else if ( modMin == 4){ 213 paintWord(txtSONO, 214 Red); 215 paintWord(txtMTRE, Off); 216 paintWord(txtMQUATTRO, 217 Yellow); 218 } 219 220 HourClock(); //void HourClock 221 MinuteClock(); 222 // void MinuteClock 223 Auguri(); // void Auguri 224 225 226 strip.show(); 227 228 } 229 if (menu==1) 230 { 231 DisplaySetHour(); 232 } 233 if (menu==2) 234 235 { 236 DisplaySetMinute(); 237 } 238 if (menu==3) 239 { 240 DisplaySetYear(); 241 242 } 243 if (menu==4) 244 { 245 DisplaySetMonth(); 246 } 247 if (menu==5) 248 249 { 250 DisplaySetDay(); 251 } 252 if (menu==6) 253 { 254 StoreAgg(); 255 256 delay(500); 257 menu=0; 258 } 259 delay(100); 260} 261void showStrip() 262 { 263 #ifdef ADAFRUIT_NEOPIXEL_H 264 // NeoPixel 265 strip.show(); 266 #endif 267 268 #ifndef ADAFRUIT_NEOPIXEL_H 269 // FastLED 270 FastLED.show(); 271 #endif 272} 273 274void 275 setPixel(int Pixel, byte red, byte green, byte blue) { 276 #ifdef ADAFRUIT_NEOPIXEL_H 277 278 // NeoPixel 279 strip.setPixelColor(Pixel, strip.Color(red, green, blue)); 280 281 #endif 282 #ifndef ADAFRUIT_NEOPIXEL_H 283 // FastLED 284 leds[Pixel].r = red; 285 286 leds[Pixel].g = green; 287 leds[Pixel].b = blue; 288 #endif 289} 290 291void 292 setAll(byte red, byte green, byte blue) { 293 for(int i = 0; i < NUM_LEDS; i++ 294 ) { 295 setPixel(i, red, green, blue); 296 } 297 showStrip(); 298} 299void 300 Auguri(){ 301 DateTime now = RTC.now(); 302 if (now.month() == 11 && now.day() 303 == 6){ //Jacopo 304 paintWord(txtAUGURI, Purple); 305 paintWord(txtJACOPO, 306 Purple); 307 paintWord(txtSIMONE, Off); 308 paintWord(txtMINU, Off); 309 310 paintWord(txtTIZIANO, Off); 311 paintWord(txtMARILENA, Off); 312 313 } 314 else if (now.month() == 4 && now.day() == 25){ //Simone 315 paintWord(txtAUGURI, 316 Purple); 317 paintWord(txtJACOPO, Off); 318 paintWord(txtSIMONE, Purple); 319 320 paintWord(txtMINU, Off); 321 paintWord(txtTIZIANO, Off); 322 paintWord(txtMARILENA, 323 Off); 324 } 325 else if (now.month() == 6 && now.day() == 1){ //Minù 326 paintWord(txtAUGURI, 327 Purple); 328 paintWord(txtJACOPO, Off); 329 paintWord(txtSIMONE, Off); 330 331 paintWord(txtMINU, Purple); 332 paintWord(txtTIZIANO, Off); 333 paintWord(txtMARILENA, 334 Off); 335 } 336 else if (now.month() == 4 && now.day() == 24){ //Tiziano 337 338 paintWord(txtAUGURI, Purple); 339 paintWord(txtJACOPO, Off); 340 341 paintWord(txtSIMONE, Off); 342 paintWord(txtMINU, Off); 343 paintWord(txtTIZIANO, 344 Purple); 345 paintWord(txtMARILENA, Off); 346 } 347 else if (now.month() 348 == 6 && now.day() == 22){ //Marilena 349 paintWord(txtAUGURI, Purple); 350 351 paintWord(txtJACOPO, Off); 352 paintWord(txtSIMONE, Off); 353 paintWord(txtMINU, 354 Off); 355 paintWord(txtTIZIANO, Off); 356 paintWord(txtMARILENA, Purple); 357 358 } 359 else{ 360 paintWord(txtAUGURI, Off); 361 paintWord(txtJACOPO, 362 Off); 363 paintWord(txtSIMONE, Off); 364 paintWord(txtMINU, Off); 365 366 paintWord(txtTIZIANO, Off); 367 paintWord(txtMARILENA, Off); 368 369 } 370} 371void DisplayDateTime () 372{ 373// We show the current date and time 374 375 DateTime now = RTC.now(); 376 377 lcd.setCursor(0, 1); 378 lcd.print("Ora:"); 379 380 if (now.hour()<=9) 381 { 382 lcd.print("0"); 383 } 384 lcd.print(now.hour(), 385 DEC); 386 oraagg=now.hour(); 387 lcd.print(":"); 388 if (now.minute()<=9) 389 390 { 391 lcd.print("0"); 392 } 393 lcd.print(now.minute(), DEC); 394 minagg=now.minute(); 395 396 lcd.print(":"); 397 if (now.second()<=9) 398 { 399 lcd.print("0"); 400 401 } 402 lcd.print(now.second(), DEC); 403 404 lcd.setCursor(0, 0); 405 lcd.print("Data: 406 "); 407 if (now.day()<=9) 408 { 409 lcd.print("0"); 410 } 411 lcd.print(now.day(), 412 DEC); 413 dayagg=now.day(); 414 lcd.print("/"); 415 if (now.month()<=9) 416 417 { 418 lcd.print("0"); 419 } 420 lcd.print(now.month(), DEC); 421 meseagg=now.month(); 422 423 lcd.print("/"); 424 lcd.print(now.year(), DEC); 425 annoagg=now.year(); 426} 427 428void 429 DisplaySetHour() 430{ 431// time setting 432 lcd.clear(); 433 DateTime now = RTC.now(); 434 435 if(digitalRead(P2)==HIGH) 436 { 437 if(oraagg==23) 438 { 439 oraagg=0; 440 441 } 442 else 443 { 444 oraagg=oraagg+1; 445 } 446 } 447 if(digitalRead(P3)==HIGH) 448 449 { 450 if(oraagg==0) 451 { 452 oraagg=23; 453 } 454 else 455 { 456 457 oraagg=oraagg-1; 458 } 459 } 460 lcd.setCursor(0,0); 461 lcd.print("Imposta 462 Ora:"); 463 lcd.setCursor(0,1); 464 lcd.print(oraagg,DEC); 465 delay(200); 466} 467 468void 469 DisplaySetMinute() 470{ 471// Setting the minutes 472 lcd.clear(); 473 if(digitalRead(P2)==HIGH) 474 475 { 476 if (minagg==59) 477 { 478 minagg=0; 479 } 480 else 481 482 { 483 minagg=minagg+1; 484 } 485 } 486 if(digitalRead(P3)==HIGH) 487 488 { 489 if (minagg==0) 490 { 491 minagg=59; 492 } 493 else 494 495 { 496 minagg=minagg-1; 497 } 498 } 499 lcd.setCursor(0,0); 500 lcd.print("Imposta 501 Minuti:"); 502 lcd.setCursor(0,1); 503 lcd.print(minagg,DEC); 504 delay(200); 505} 506 507 508void DisplaySetYear() 509{ 510// setting the year 511 lcd.clear(); 512 if(digitalRead(P2)==HIGH) 513 514 { 515 annoagg=annoagg+1; 516 } 517 if(digitalRead(P3)==HIGH) 518 { 519 520 annoagg=annoagg-1; 521 } 522 lcd.setCursor(0,0); 523 lcd.print("Imposta 524 Anno:"); 525 lcd.setCursor(0,1); 526 lcd.print(annoagg,DEC); 527 delay(200); 528} 529 530void 531 DisplaySetMonth() 532{ 533// Setting the month 534 lcd.clear(); 535 if(digitalRead(P2)==HIGH) 536 537 { 538 if (meseagg==12) 539 { 540 meseagg=1; 541 } 542 else 543 544 { 545 meseagg=meseagg+1; 546 } 547 } 548 if(digitalRead(P3)==HIGH) 549 550 { 551 if (meseagg==1) 552 { 553 meseagg=12; 554 } 555 else 556 557 { 558 meseagg=meseagg-1; 559 } 560 } 561 lcd.setCursor(0,0); 562 lcd.print("Imposta 563 Mese:"); 564 lcd.setCursor(0,1); 565 lcd.print(meseagg,DEC); 566 delay(200); 567} 568 569void 570 DisplaySetDay() 571{ 572// Setting the day 573 lcd.clear(); 574 if(digitalRead(P2)==HIGH) 575 576 { 577 if (dayagg==31) 578 { 579 dayagg=1; 580 } 581 else 582 583 { 584 dayagg=dayagg+1; 585 } 586 } 587 if(digitalRead(P3)==HIGH) 588 589 { 590 if (dayagg==1) 591 { 592 dayagg=31; 593 } 594 else 595 596 { 597 dayagg=dayagg-1; 598 } 599 } 600 lcd.setCursor(0,0); 601 lcd.print("Imposta 602 Giorno:"); 603 lcd.setCursor(0,1); 604 lcd.print(dayagg,DEC); 605 delay(200); 606} 607 608void 609 StoreAgg() 610{ 611// Variable saving 612 lcd.clear(); 613 lcd.setCursor(0,0); 614 615 lcd.print("SALVATAGGIO IN"); 616 lcd.setCursor(0,1); 617 lcd.print("CORSO"); 618 619 RTC.adjust(DateTime(annoagg,meseagg,dayagg,oraagg,minagg,0)); 620 delay(200); 621} 622void 623 HourClock() 624{ 625 DateTime now = RTC.now(); 626 int timeMin = now.minute(); 627 628 int modMin = timeMin % 5; // https://www.arduino.cc/en/Reference/Modulo 629 int 630 ora = now.hour() ; 631 if ( timeMin >= 40){ // from the 40 minutes, add 1 to "hour" 632 633 ora = ora+1 ; 634 } 635 switch (ora ) { 636 case 0: 637 case 12: 638 639 case 24: 640 paintWord(txtUNDICI, Off); 641 strip.show(); 642 643 if ( modMin == 0){ 644 paintWord(txtDODOCI, White); 645 strip.show(); 646 647 } 648 else if ( modMin == 1){ 649 paintWord(txtDODOCI, 650 Yellow); 651 strip.show(); 652 } 653 else if ( modMin == 654 2){ 655 paintWord(txtDODOCI, Green); 656 strip.show(); 657 658 } 659 else if ( modMin == 3){ 660 paintWord(txtDODOCI, 661 Blue); 662 strip.show(); 663 } 664 else if ( modMin == 665 4){ 666 paintWord(txtDODOCI, Red); 667 strip.show(); 668 } 669 670 671break; 672 case 1: 673 case 13: 674 paintWord(txtDODOCI, 675 Off); 676 strip.show(); 677 678 if ( modMin == 0){ 679 680 paintWord(txtUNA, White); 681 strip.show(); 682 } 683 684 else if ( modMin == 1){ 685 paintWord(txtUNA, Yellow); 686 strip.show(); 687 688 } 689 else if ( modMin == 2){ 690 paintWord(txtUNA, Green); 691 692 strip.show(); 693 } 694 else if ( modMin == 3){ 695 paintWord(txtUNA, 696 Blue); 697 strip.show(); 698 } 699 else if ( modMin == 700 4){ 701 paintWord(txtUNA, Red); 702 strip.show(); 703 } 704 705 706 707break; 708 case 2: 709 case 14: 710 paintWord(txtUNA, 711 Off); 712 strip.show(); 713 714 if ( modMin == 0){ 715 716 paintWord(txtDUE, White); 717 strip.show(); 718 } 719 720 else if ( modMin == 1){ 721 paintWord(txtDUE, Yellow); 722 strip.show(); 723 724 } 725 else if ( modMin == 2){ 726 paintWord(txtDUE, Green); 727 728 strip.show(); 729 } 730 else if ( modMin == 3){ 731 paintWord(txtDUE, 732 Blue); 733 strip.show(); 734 } 735 else if ( modMin == 736 4){ 737 paintWord(txtDUE, Red); 738 strip.show(); 739 } 740break; 741 742 case 3: 743 case 15: 744 745 paintWord(txtDUE, Off); 746 strip.show(); 747 748 749 if ( modMin == 0){ 750 paintWord(txtTRE, White); 751 752 strip.show(); 753 } 754 else if ( modMin == 1){ 755 paintWord(txtTRE, 756 Yellow); 757 strip.show(); 758 } 759 else if ( modMin == 760 2){ 761 paintWord(txtTRE, Green); 762 strip.show(); 763 } 764 765 else if ( modMin == 3){ 766 paintWord(txtTRE, Blue); 767 strip.show(); 768 769 } 770 else if ( modMin == 4){ 771 paintWord(txtTRE, Red); 772 773 strip.show(); 774 } 775 776break; 777 case 4: 778 779 case 16: 780 781 paintWord(txtTRE, Off); 782 strip.show(); 783 784 785 if ( modMin == 0){ 786 paintWord(txtQUATTRO, White); 787 788 strip.show(); 789 } 790 else if ( modMin == 1){ 791 paintWord(txtQUATTRO, 792 Yellow); 793 strip.show(); 794 } 795 else if ( modMin == 796 2){ 797 paintWord(txtQUATTRO, Green); 798 strip.show(); 799 800 } 801 else if ( modMin == 3){ 802 paintWord(txtQUATTRO, 803 Blue); 804 strip.show(); 805 } 806 else if ( modMin == 807 4){ 808 paintWord(txtQUATTRO, Red); 809 strip.show(); 810 811 } 812 813break; 814 case 5: 815 case 17: 816 817 paintWord(txtQUATTRO, 818 Off); 819 strip.show(); 820 821 if ( modMin == 0){ 822 823 paintWord(txtCINQUE, White); 824 strip.show(); 825 } 826 827 else if ( modMin == 1){ 828 paintWord(txtCINQUE, Yellow); 829 830 strip.show(); 831 } 832 else if ( modMin == 2){ 833 paintWord(txtCINQUE, 834 Green); 835 strip.show(); 836 } 837 else if ( modMin == 838 3){ 839 paintWord(txtCINQUE, Blue); 840 strip.show(); 841 842 } 843 else if ( modMin == 4){ 844 paintWord(txtCINQUE, 845 Red); 846 strip.show(); 847 } 848 849break; 850 case 851 6: 852 case 18: 853 854 paintWord(txtCINQUE, Off); 855 strip.show(); 856 857 858 if ( modMin == 0){ 859 paintWord(txtSEI, White); 860 861 strip.show(); 862 } 863 else if ( modMin == 1){ 864 paintWord(txtSEI, 865 Yellow); 866 strip.show(); 867 } 868 else if ( modMin == 869 2){ 870 paintWord(txtSEI, Green); 871 strip.show(); 872 } 873 874 else if ( modMin == 3){ 875 paintWord(txtSEI, Blue); 876 strip.show(); 877 878 } 879 else if ( modMin == 4){ 880 paintWord(txtSEI, Red); 881 882 strip.show(); 883 } 884 885break; 886 case 7: 887 888 case 19: 889 890 paintWord(txtSEI, Off); 891 strip.show(); 892 893 894 if ( modMin == 0){ 895 paintWord(txtSETTE, White); 896 897 strip.show(); 898 } 899 else if ( modMin == 1){ 900 paintWord(txtSETTE, 901 Yellow); 902 strip.show(); 903 } 904 else if ( modMin == 905 2){ 906 paintWord(txtSETTE, Green); 907 strip.show(); 908 909 } 910 else if ( modMin == 3){ 911 paintWord(txtSETTE, 912 Blue); 913 strip.show(); 914 } 915 else if ( modMin == 916 4){ 917 paintWord(txtSETTE, Red); 918 strip.show(); 919 } 920 921 922break; 923 case 8: 924 case 20: 925 926 paintWord(txtSETTE, 927 Off); 928 strip.show(); 929 930 if ( modMin == 0){ 931 932 paintWord(txtOTTO, White); 933 strip.show(); 934 } 935 936 else if ( modMin == 1){ 937 paintWord(txtOTTO, Yellow); 938 strip.show(); 939 940 } 941 else if ( modMin == 2){ 942 paintWord(txtOTTO, Green); 943 944 strip.show(); 945 } 946 else if ( modMin == 3){ 947 paintWord(txtOTTO, 948 Blue); 949 strip.show(); 950 } 951 else if ( modMin == 952 4){ 953 paintWord(txtOTTO, Red); 954 strip.show(); 955 } 956 957 958break; 959 case 9: 960 case 21: 961 962 paintWord(txtOTTO, 963 Off); 964 strip.show(); 965 966 if ( modMin == 0){ 967 968 paintWord(txtNOVE, White); 969 strip.show(); 970 } 971 972 else if ( modMin == 1){ 973 paintWord(txtNOVE, Yellow); 974 strip.show(); 975 976 } 977 else if ( modMin == 2){ 978 paintWord(txtNOVE, Green); 979 980 strip.show(); 981 } 982 else if ( modMin == 3){ 983 paintWord(txtNOVE, 984 Blue); 985 strip.show(); 986 } 987 else if ( modMin == 988 4){ 989 paintWord(txtNOVE, Red); 990 strip.show(); 991 } 992 993 994break; 995 case 10: 996 case 22: 997 998 paintWord(txtNOVE, 999 Off); 1000 strip.show(); 1001 1002 if ( modMin == 0){ 1003 1004 paintWord(txtDIECI, White); 1005 strip.show(); 1006 } 1007 1008 else if ( modMin == 1){ 1009 paintWord(txtDIECI, Yellow); 1010 1011 strip.show(); 1012 } 1013 else if ( modMin == 2){ 1014 paintWord(txtDIECI, 1015 Green); 1016 strip.show(); 1017 } 1018 else if ( modMin == 1019 3){ 1020 paintWord(txtDIECI, Blue); 1021 strip.show(); 1022 } 1023 1024 else if ( modMin == 4){ 1025 paintWord(txtDIECI, Red); 1026 strip.show(); 1027 1028 } 1029 1030break; 1031 case 11: 1032 case 23: 1033 1034 paintWord(txtDIECI, 1035 Off); 1036 strip.show(); 1037 1038 if ( modMin == 0){ 1039 1040 paintWord(txtUNDICI, White); 1041 strip.show(); 1042 } 1043 1044 else if ( modMin == 1){ 1045 paintWord(txtUNDICI, Yellow); 1046 1047 strip.show(); 1048 } 1049 else if ( modMin == 2){ 1050 paintWord(txtUNDICI, 1051 Green); 1052 strip.show(); 1053 } 1054 else if ( modMin == 1055 3){ 1056 paintWord(txtUNDICI, Blue); 1057 strip.show(); 1058 1059 } 1060 else if ( modMin == 4){ 1061 paintWord(txtUNDICI, 1062 Red); 1063 strip.show(); 1064 } 1065break; 1066 } 1067} 1068void 1069 MinuteClock() 1070{ 1071 DateTime now = RTC.now(); 1072 int timeMin = now.minute(); 1073 1074 int modMin = timeMin % 5; // https://www.arduino.cc/en/Reference/Modulo 1075 switch 1076 (now.minute()) { 1077 case 5: 1078 case 6: 1079 case 7: 1080 case 8: 1081 1082 case 9: 1083 1084 if ( modMin == 0){ 1085 paintWord(txtE, White); 1086 1087 paintWord(txtMCINQUE, White); 1088 strip.show(); 1089 } 1090 1091 else if ( modMin == 1){ 1092 paintWord(txtE, Yellow); 1093 paintWord(txtMCINQUE, 1094 Yellow); 1095 strip.show(); 1096 } 1097 else if ( modMin == 1098 2){ 1099 paintWord(txtE, Green); 1100 paintWord(txtMCINQUE, 1101 Green); 1102 strip.show(); 1103 } 1104 else if ( modMin == 1105 3){ 1106 paintWord(txtE, Blue); 1107 paintWord(txtMCINQUE, Blue); 1108 1109 strip.show(); 1110 } 1111 else if ( modMin == 4){ 1112 paintWord(txtE, 1113 Red); 1114 paintWord(txtMCINQUE, Red); 1115 strip.show(); 1116 1117 } 1118break; 1119 1120 1121 case 10: 1122 case 11: 1123 case 12: 1124 1125 case 13: 1126 case 14: 1127 paintWord(txtMCINQUE, Off); 1128 strip.show(); 1129 1130 if ( modMin == 0){ 1131 paintWord(txtE, White); 1132 paintWord(txtMDIECI, 1133 White); 1134 strip.show(); 1135 } 1136 else if ( modMin == 1137 1){ 1138 paintWord(txtE, Yellow); 1139 paintWord(txtMDIECI, 1140 Yellow); 1141 strip.show(); 1142 } 1143 else if ( modMin == 1144 2){ 1145 paintWord(txtE, Green); 1146 paintWord(txtMDIECI, Green); 1147 1148 strip.show(); 1149 } 1150 else if ( modMin == 3){ 1151 paintWord(txtE, 1152 Blue); 1153 paintWord(txtMDIECI, Blue); 1154 strip.show(); 1155 1156 } 1157 else if ( modMin == 4){ 1158 paintWord(txtE, Red); 1159 1160 paintWord(txtMDIECI, Red); 1161 strip.show(); 1162 } 1163 1164 1165break; 1166 1167 case 15: 1168 case 16: 1169 case 17: 1170 case 1171 18: 1172 case 19: 1173 paintWord(txtMDIECI, Off); 1174 strip.show(); 1175 1176 if ( modMin == 0){ 1177 paintWord(txtE, White); 1178 1179 paintWord(txtQUINDICI, White); 1180 strip.show(); 1181 } 1182 1183 else if ( modMin == 1){ 1184 paintWord(txtE, Yellow); 1185 paintWord(txtQUINDICI, 1186 Yellow); 1187 strip.show(); 1188 } 1189 else if ( modMin == 1190 2){ 1191 paintWord(txtE, Green); 1192 paintWord(txtQUINDICI, 1193 Green); 1194 strip.show(); 1195 } 1196 else if ( modMin == 1197 3){ 1198 paintWord(txtE, Blue); 1199 paintWord(txtQUINDICI, 1200 Blue); 1201 strip.show(); 1202 } 1203 else if ( modMin == 1204 4){ 1205 paintWord(txtE, Red); 1206 paintWord(txtQUINDICI, Red); 1207 1208 strip.show(); 1209 } 1210break; 1211 1212 1213 case 20: 1214 case 1215 21: 1216 case 22: 1217 case 23: 1218 case 24: 1219 paintWord(txtQUINDICI, 1220 Off); 1221 strip.show(); 1222 if ( modMin == 0){ 1223 paintWord(txtE, 1224 White); 1225 paintWord(txtVENTI, White); 1226 strip.show(); 1227 1228 } 1229 else if ( modMin == 1){ 1230 paintWord(txtE, Yellow); 1231 1232 paintWord(txtVENTI, Yellow); 1233 strip.show(); 1234 } 1235 1236 else if ( modMin == 2){ 1237 paintWord(txtE, Green); 1238 paintWord(txtVENTI, 1239 Green); 1240 strip.show(); 1241 } 1242 else if ( modMin == 1243 3){ 1244 paintWord(txtE, Blue); 1245 paintWord(txtVENTI, Blue); 1246 1247 strip.show(); 1248 } 1249 else if ( modMin == 4){ 1250 paintWord(txtE, 1251 Red); 1252 paintWord(txtVENTI, Red); 1253 strip.show(); 1254 1255 } 1256break; 1257 1258 case 25: 1259 case 26: 1260 case 27: 1261 case 1262 28: 1263 case 29: 1264 1265 if ( modMin == 0){ 1266 paintWord(txtE, 1267 White); 1268 paintWord(txtVENTI, White); 1269 paintWord(txtMCINQUE, 1270 White); 1271 strip.show(); 1272 } 1273 else if ( modMin == 1274 1){ 1275 paintWord(txtE, Yellow); 1276 paintWord(txtVENTI, Yellow); 1277 1278 paintWord(txtMCINQUE, Yellow); 1279 strip.show(); 1280 } 1281 1282 else if ( modMin == 2){ 1283 paintWord(txtE, Green); 1284 paintWord(txtVENTI, 1285 Green); 1286 paintWord(txtMCINQUE, Green); 1287 strip.show(); 1288 1289 } 1290 else if ( modMin == 3){ 1291 paintWord(txtE, Blue); 1292 1293 paintWord(txtVENTI, Blue); 1294 paintWord(txtMCINQUE, Blue); 1295 1296 strip.show(); 1297 } 1298 else if ( modMin == 4){ 1299 paintWord(txtE, 1300 Red); 1301 paintWord(txtVENTI, Red); 1302 paintWord(txtMCINQUE, 1303 Red); 1304 strip.show(); 1305 } 1306break; 1307 1308 case 30: 1309 1310 case 31: 1311 case 32: 1312 case 33: 1313 case 34: 1314 paintWord(txtVENTI, 1315 Off); 1316 paintWord(txtMCINQUE, Off); 1317 strip.show(); 1318 1319 if ( modMin == 0){ 1320 paintWord(txtE, White); 1321 paintWord(txtTRENTA, 1322 White); 1323 strip.show(); 1324 } 1325 else if ( modMin == 1326 1){ 1327 paintWord(txtE, Yellow); 1328 paintWord(txtTRENTA, 1329 Yellow); 1330 strip.show(); 1331 } 1332 else if ( modMin == 1333 2){ 1334 paintWord(txtE, Green); 1335 paintWord(txtTRENTA, Green); 1336 1337 strip.show(); 1338 } 1339 else if ( modMin == 3){ 1340 paintWord(txtE, 1341 Blue); 1342 paintWord(txtTRENTA, Blue); 1343 strip.show(); 1344 1345 } 1346 else if ( modMin == 4){ 1347 paintWord(txtE, Red); 1348 1349 paintWord(txtTRENTA, Red); 1350 strip.show(); 1351 } 1352break; 1353 1354 1355 case 35: 1356 case 36: 1357 case 37: 1358 case 38: 1359 case 39: 1360 1361 if ( modMin == 0){ 1362 paintWord(txtE, White); 1363 paintWord(txtTRENTA, 1364 White); 1365 paintWord(txtMCINQUE, White); 1366 strip.show(); 1367 1368 } 1369 else if ( modMin == 1){ 1370 paintWord(txtE, Yellow); 1371 1372 paintWord(txtTRENTA, Yellow); 1373 paintWord(txtMCINQUE, Yellow); 1374 1375 strip.show(); 1376 } 1377 else if ( modMin == 2){ 1378 paintWord(txtE, 1379 Green); 1380 paintWord(txtTRENTA, Green); 1381 paintWord(txtMCINQUE, 1382 Green); 1383 strip.show(); 1384 } 1385 else if ( modMin == 1386 3){ 1387 paintWord(txtE, Blue); 1388 paintWord(txtTRENTA, Blue); 1389 1390 paintWord(txtMCINQUE, Blue); 1391 strip.show(); 1392 } 1393 1394 else if ( modMin == 4){ 1395 paintWord(txtE, Red); 1396 paintWord(txtTRENTA, 1397 Red); 1398 paintWord(txtMCINQUE, Red); 1399 strip.show(); 1400 1401 } 1402break; 1403 1404 case 40: 1405 case 41: 1406 case 42: 1407 case 1408 43: 1409 case 44: 1410 paintWord(txtE, Off); 1411 paintWord(txtTRENTA, 1412 Off); 1413 paintWord(txtMCINQUE, Off); 1414 strip.show(); 1415 1416 if ( modMin == 0){ 1417 paintWord(txtMENO, White); //from the 1418 40 minutes, add 1 to "now" and Printing "meno" 1419 paintWord(txtVENTI, 1420 White); 1421 strip.show(); 1422 } 1423 else if ( modMin == 1424 1){ 1425 paintWord(txtMENO, Yellow); 1426 paintWord(txtVENTI, 1427 Yellow); 1428 strip.show(); 1429 } 1430 else if ( modMin == 1431 2){ 1432 paintWord(txtMENO, Green); 1433 paintWord(txtVENTI, 1434 Green); 1435 strip.show(); 1436 } 1437 else if ( modMin == 1438 3){ 1439 paintWord(txtMENO, Blue); 1440 paintWord(txtVENTI, 1441 Blue); 1442 strip.show(); 1443 } 1444 else if ( modMin == 1445 4){ 1446 paintWord(txtMENO, Red); 1447 paintWord(txtVENTI, Red); 1448 1449 strip.show(); 1450 } 1451break; 1452 1453 case 45: 1454 case 1455 46: 1456 case 47: 1457 case 48: 1458 case 49: 1459 paintWord(txtVENTI, 1460 Off); 1461 strip.show(); 1462 if ( modMin == 0){ 1463 paintWord(txtMENO, 1464 White); 1465 paintWord(txtQUINDICI, White); 1466 strip.show(); 1467 1468 } 1469 else if ( modMin == 1){ 1470 paintWord(txtMENO, Yellow); 1471 1472 paintWord(txtQUINDICI, Yellow); 1473 strip.show(); 1474 } 1475 1476 else if ( modMin == 2){ 1477 paintWord(txtMENO, Green); 1478 paintWord(txtQUINDICI, 1479 Green); 1480 strip.show(); 1481 } 1482 else if ( modMin == 1483 3){ 1484 paintWord(txtMENO, Blue); 1485 paintWord(txtQUINDICI, 1486 Blue); 1487 strip.show(); 1488 } 1489 else if ( modMin == 1490 4){ 1491 paintWord(txtMENO, Red); 1492 paintWord(txtQUINDICI, 1493 Red); 1494 strip.show(); 1495 } 1496break; 1497 1498 case 50: 1499 1500 case 51: 1501 case 52: 1502 case 53: 1503 case 54: 1504 paintWord(txtQUINDICI, 1505 Off); 1506 strip.show(); 1507 if ( modMin == 0){ 1508 paintWord(txtMENO, 1509 White); 1510 paintWord(txtMDIECI, White); 1511 strip.show(); 1512 1513 } 1514 else if ( modMin == 1){ 1515 paintWord(txtMENO, Yellow); 1516 1517 paintWord(txtMDIECI, Yellow); 1518 strip.show(); 1519 } 1520 1521 else if ( modMin == 2){ 1522 paintWord(txtMENO, Green); 1523 paintWord(txtMDIECI, 1524 Green); 1525 strip.show(); 1526 } 1527 else if ( modMin == 1528 3){ 1529 paintWord(txtMENO, Blue); 1530 paintWord(txtMDIECI, 1531 Blue); 1532 strip.show(); 1533 } 1534 else if ( modMin == 1535 4){ 1536 paintWord(txtMENO, Red); 1537 paintWord(txtMDIECI, 1538 Red); 1539 strip.show(); 1540 } 1541break; 1542 1543 case 55: 1544 1545 case 56: 1546 case 57: 1547 case 58: 1548 case 59: 1549 1550 paintWord(txtMDIECI, 1551 Off); 1552 strip.show(); 1553 if ( modMin == 0){ 1554 paintWord(txtMENO, 1555 White); 1556 paintWord(txtMCINQUE, White); 1557 strip.show(); 1558 1559 } 1560 else if ( modMin == 1){ 1561 paintWord(txtMENO, Yellow); 1562 1563 paintWord(txtMCINQUE, Yellow); 1564 strip.show(); 1565 } 1566 1567 else if ( modMin == 2){ 1568 paintWord(txtMENO, Green); 1569 paintWord(txtMCINQUE, 1570 Green); 1571 strip.show(); 1572 } 1573 else if ( modMin == 1574 3){ 1575 paintWord(txtMENO, Blue); 1576 paintWord(txtMCINQUE, 1577 Blue); 1578 strip.show(); 1579 } 1580 else if ( modMin == 1581 4){ 1582 paintWord(txtMENO, Red); 1583 paintWord(txtMCINQUE, 1584 Red); 1585 strip.show(); 1586 } 1587break; 1588 1589 case 0: 1590 1591 case 1: 1592 case 2: 1593 case 3: 1594 case 4: 1595 paintWord(txtMENO, 1596 Off); 1597 paintWord(txtMCINQUE, Off); 1598 strip.show(); 1599break; 1600 1601 } 1602} 1603void paintWord(int arrWord[], uint32_t intColor){ 1604 for(int i 1605 = 0; i < strip.numPixels() + 1; i++){ 1606 if(arrWord[i] == -1){ 1607 strip.show(); 1608 1609 break; 1610 } 1611 else{ 1612 strip.setPixelColor(arrWord[i],intColor); 1613 1614 } 1615 } 1616}
Downloadable files
electric schematic
electric schematic
electric schematic
electric schematic
Fritzing schematic
Fritzing schematic
Documentation
Screen
Screen
Screen
Screen
Comments
Only logged in users can leave comments
Anonymous user
4 years ago
Complimenti bel progettino, ne sto finendo anche io uno simile, quando si sono accesi tutti i LED, tanta soddisfazione, il mio però segna solo l'ora e non ho usato RTC. Ora sono nella fase di programmazione e poi finirò il case. Saluti
Anonymous user
8 years ago
ciao .quale strips di preciso hai usato?..bel progetto
Anonymous user
2 years ago
Grazie, ricevuto la risposta, non vedo l'ora di ricevere gli appunti Donciccio
Anonymous user
2 years ago
Ciao Tittiamo, quello che hai fatto è impressionante, bellissimo a dir poco, sto cercando di fare la stessa cosa. Ma potresti dirmi come posso fare per cambiare i nomi? e Possibilmente le misure esatte. Ti ringrazio Donciccio
tittiamo68
2 years ago
La spaziatura di ciascun led è di 16,6 millimetri, dunque devi disegnare una griglia con queste dimensioni. Per creare lo schermo ho iniziato a ragionare con Excel, poi ho utilizzato Inkscape, ho disegnato una griglia con le misure che ti ho scritto, ho aggiunto le lettere. Unica accortezza che devi usare è separare le ore ( in alto) dai minuti (in basso) e tra i due mettere le parole "E" e "MENO", se le sposti dalle loro posizioni devi cambiare il codice. I nomi li ho messi in quella posizione per un ottimizzazione di spazio. Se mi scrivi a "tittiduino@ gmail.com" (senza spazio ) ti posso mandare i miei appunti. Ciao
tittiamo68
2 years ago
Ciao Moreno Ho utilizzato 2, 5 metri di la striscia Neopixel bianca, 60 led per metro (https://www.adafruit.com/products/1138) , ed incollati con biadesivo, comunque puoi utilizzare qualunque altra striscia, l'importante che sia "ws2812b" 60 Led per metro (https://www.google.it/search?q=%22ws2812b%22+60&oq=%22ws2812b%22+60&aqs=chrome..69i57.551j0j7&sourceid=chrome&ie=UTF-8) Sempre a tua disposizione per qualsiasi chiarimento. Tiziano
Anonymous user
2 years ago
Complimenti bel progettino, ne sto finendo anche io uno simile, quando si sono accesi tutti i LED, tanta soddisfazione, il mio però segna solo l'ora e non ho usato RTC. Ora sono nella fase di programmazione e poi finirò il case. Saluti