Tittiamo
Published © GPL3+

Italian Word Clock

Clock that speaks in Italian.

IntermediateFull instructions provided1 hour4,561
Italian Word Clock

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
NeoPixel strip
NeoPixel strip
144
×1
Standard LCD - 16x2 White on Blue
Adafruit Standard LCD - 16x2 White on Blue
with I2C module
×1
Real Time Clock (RTC)
Real Time Clock (RTC)
×1
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×4
Resistor 10k ohm
Resistor 10k ohm
×3
Resistor 475 ohm
Resistor 475 ohm
×1
1N4007 – High Voltage, High Current Rated Diode
1N4007 – High Voltage, High Current Rated Diode
×3
DC DC Converter Adjustable Step Down
×1
Wall frame RIBBA (Ikea)
×1
Gewiss box cover 150 x 110
×1
aluminum strips 230 mm x 10 mm x 1mm
×1

Story

Read more

Custom parts and enclosures

Screen

Schematics

electric schematic

Wordclock fnz4riitfv

Fritzing schematic

Code

Italian WordClock

Arduino
/*
:Project: WordClock
:Author: Tiziano Bianchettin
:Date: 25/09/2016
:Revision: 1
:License: Public Domain
thanks to:
  http://www.instructables.com/id/Javelins-Word-Clock/
  http://arduinoenonsolo.blogspot.it/2012/12/orologio-con-arduino-e-il-ds1307.html
  http://www.mauroalfieri.it/
  http://www.danielealberti.it/
  http://www.maffucci.it/
  My electronics laboratory professor "Perito Carli"  
*/
//************libraries**************//
#include <Wire.h>
#include <RTClib.h>
#include <LiquidCrystal_I2C.h>
#include <Adafruit_NeoPixel.h>

//***********neopixel****************//
#define PIN            9 // pin neopixel
#define NUM_LEDS 144 // 12 x 12
#define GIORNO 255 // full on
#define SERA 25 // a tenth on
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800); // 144 led, pin 9
int intBrightness;

//****************COLORS***********//
uint32_t Red = strip.Color(255, 0, 0); 
uint32_t Green = strip.Color( 0, 255, 0);
uint32_t Blue = strip.Color( 0, 0, 255);
uint32_t White = strip.Color( 255, 255, 255);
uint32_t Yellow = strip.Color( 255, 255, 0);
uint32_t Purple = strip.Color( 60, 0, 255);
uint32_t Off = strip.Color( 0, 0, 0);


LiquidCrystal_I2C lcd(0x27,16,2); // Display  I2C 16 x 2
RTC_DS1307 RTC;
int P1=6; // Button SET MENU'
int P2=7; // Button +
int P3=8; // Button -
int oraagg;
int minagg;
int annoagg;
int meseagg;
int dayagg;
int menu =0;
int ora;


//********Presentation*********//
int  txtSONO[] = {1,2,3,4,6,7,9,10,11,-1};

//********Hours*********//
int  txtUNA[] = {20,21,22,-1};
int  txtDUE[] = {17,18,19,-1};
int  txtTRE[] = {57,58,59,-1};
int  txtQUATTRO[] = {96,97,98,99,100,101,102,-1};
int  txtCINQUE[] = {30,31,32,33,34,35,-1};
int  txtSEI[] = {103,104,105,-1};
int  txtSETTE[] = {48,49,50,51,52,-1};
int  txtOTTO[] = {72,73,74,75,-1};
int  txtNOVE[] = {60,61,62,63,-1};
int  txtDIECI[] = {12,13,14,15,16,-1};
int  txtUNDICI[] = {84,85,86,87,88,89,-1};
int  txtDODOCI[] = {90,91,92,93,94,95,-1};

//********Happy birthday*********//
int  txtAUGURI[] = {24,25,26,27,28,29,-1};
int  txtSIMONE[] = {36,37,38,39,40,41,-1};
int  txtJACOPO[] = {42,43,44,45,46,47,-1};
int  txtMINU[] = {53,54,55,56,-1};
int  txtTIZIANO[] = {65,66,67,68,69,70,71,-1};
int  txtMARILENA[] = {76,77,78,79,80,81,82,83,-1};

//********Minutes*********//
int  txtE[] = {107,-1};
int  txtMENO[] = {116,117,118,119,-1};
int  txtMUNO[] = {5,-1};
int  txtMDUE[] = {64,-1};
int  txtMTRE[] = {106,-1};
int  txtMQUATTRO[] = {125,-1};
int  txtMCINQUE[] = {132,133,134,135,136,137,-1};
int  txtMDIECI[] = {120,121,122,123,124,-1};
int  txtQUINDICI[] = {108,109,110,111,112,113,114,115,-1};
int  txtVENTI[] = {139,140,141,142,143,-1};
int  txtTRENTA[] = {126,127,128,129,130,131,-1};

void setup()
{

  strip.begin();
  strip.show();
  lcd.begin();
  lcd.backlight();
  lcd.clear();

  pinMode(P1,INPUT);
  pinMode(P2,INPUT);
  pinMode(P3,INPUT);

  Serial.begin(9600);
  Wire.begin();
  RTC.begin();

  if (! RTC.isrunning()) {
    Serial.println("RTC is NOT running!");
    // Set the date and time at compile time
    RTC.adjust(DateTime(__DATE__, __TIME__));
  }
  // RTC.adjust(DateTime(__DATE__, __TIME__)); //removing "//" to adjust the time
    // The default display shows the date and time
  int menu=0;
}
 
void loop()
{ 

// check if you press the SET button and increase the menu index
  if(digitalRead(P1))
  {
   menu=menu+1;
  }
// in which subroutine should we go?
  if (menu==0)
    {
     DisplayDateTime(); // void DisplayDateTime
     DateTime now = RTC.now();
     if((now.hour() >= 19) || (now.hour() < 7 )){ // adjust brightness day - night
      intBrightness =  SERA;
      }
      else{
      intBrightness =  GIORNO;
      }
     strip.setBrightness(intBrightness);
     strip.show();
     int timeMin = now.minute();
     int modMin = timeMin % 5; // https://www.arduino.cc/en/Reference/Modulo
     if ( modMin == 0){ // every minute the LEDs change color and lights up the corresponding number
        paintWord(txtSONO, White);
       paintWord(txtMQUATTRO, OFF);
        }
     else if ( modMin == 1){
          paintWord(txtSONO, Yellow);
          paintWord(txtMUNO, Red);
        }
     else if ( modMin == 2){
          paintWord(txtSONO, Green);
          paintWord(txtMUNO, Off);
          paintWord(txtMDUE, Blue);
        }
     else if ( modMin == 3){
          paintWord(txtSONO, Blue);
          paintWord(txtMDUE, Off);
          paintWord(txtMTRE, Green);
        }
     else if ( modMin == 4){
          paintWord(txtSONO, Red);
          paintWord(txtMTRE, Off);
          paintWord(txtMQUATTRO, Yellow);
        }
    
     HourClock(); //void HourClock
     MinuteClock(); // void MinuteClock
     Auguri(); // void Auguri
     
    
     strip.show();
    }
  if (menu==1)
    {
    DisplaySetHour();
    }
  if (menu==2)
    {
    DisplaySetMinute();
    }
  if (menu==3)
    {
    DisplaySetYear();
    }
  if (menu==4)
    {
    DisplaySetMonth();
    }
  if (menu==5)
    {
    DisplaySetDay();
    }
  if (menu==6)
    {
    StoreAgg(); 
    delay(500);
    menu=0;
    }
    delay(100);
}
void showStrip() {
 #ifdef ADAFRUIT_NEOPIXEL_H 
   // NeoPixel
   strip.show();
 #endif
 #ifndef ADAFRUIT_NEOPIXEL_H
   // FastLED
   FastLED.show();
 #endif
}

void setPixel(int Pixel, byte red, byte green, byte blue) {
 #ifdef ADAFRUIT_NEOPIXEL_H 
   // NeoPixel
   strip.setPixelColor(Pixel, strip.Color(red, green, blue));
 #endif
 #ifndef ADAFRUIT_NEOPIXEL_H 
   // FastLED
   leds[Pixel].r = red;
   leds[Pixel].g = green;
   leds[Pixel].b = blue;
 #endif
}

void setAll(byte red, byte green, byte blue) {
  for(int i = 0; i < NUM_LEDS; i++ ) {
    setPixel(i, red, green, blue); 
  }
  showStrip();
}
void Auguri(){
    DateTime now = RTC.now();
    if (now.month() == 11 && now.day() == 6){ //Jacopo
        paintWord(txtAUGURI, Purple);
        paintWord(txtJACOPO, Purple);
        paintWord(txtSIMONE, Off);
        paintWord(txtMINU, Off);
        paintWord(txtTIZIANO, Off);
        paintWord(txtMARILENA, Off);
    }
    else if (now.month() == 4 && now.day() == 25){ //Simone
        paintWord(txtAUGURI, Purple);
        paintWord(txtJACOPO, Off);
        paintWord(txtSIMONE, Purple);
        paintWord(txtMINU, Off);
        paintWord(txtTIZIANO, Off);
        paintWord(txtMARILENA, Off);
    }
    else if (now.month() == 6 && now.day() == 1){ //Minù
        paintWord(txtAUGURI, Purple);
        paintWord(txtJACOPO, Off);
        paintWord(txtSIMONE, Off);
        paintWord(txtMINU, Purple);
        paintWord(txtTIZIANO, Off);
        paintWord(txtMARILENA, Off);
    }
    else if (now.month() == 4 && now.day() == 24){ //Tiziano
        paintWord(txtAUGURI, Purple);
        paintWord(txtJACOPO, Off);
        paintWord(txtSIMONE, Off);
        paintWord(txtMINU, Off);
        paintWord(txtTIZIANO, Purple);
        paintWord(txtMARILENA, Off);
    }
    else if (now.month() == 6 && now.day() == 22){ //Marilena
        paintWord(txtAUGURI, Purple);
        paintWord(txtJACOPO, Off);
        paintWord(txtSIMONE, Off);
        paintWord(txtMINU, Off);
        paintWord(txtTIZIANO, Off);
        paintWord(txtMARILENA, Purple);
    }
    else{
        paintWord(txtAUGURI, Off);
        paintWord(txtJACOPO, Off);
        paintWord(txtSIMONE, Off);
        paintWord(txtMINU, Off);
        paintWord(txtTIZIANO, Off);
        paintWord(txtMARILENA, Off);
    }
}
void DisplayDateTime ()
{
// We show the current date and time
  DateTime now = RTC.now();

  lcd.setCursor(0, 1);
  lcd.print("Ora:");
  if (now.hour()<=9)
  {
    lcd.print("0");
  }
  lcd.print(now.hour(), DEC);
  oraagg=now.hour();
  lcd.print(":");
  if (now.minute()<=9)
  {
    lcd.print("0");
  }
  lcd.print(now.minute(), DEC);
  minagg=now.minute();
  lcd.print(":");
  if (now.second()<=9)
  {
    lcd.print("0");
  }
  lcd.print(now.second(), DEC);

  lcd.setCursor(0, 0);
  lcd.print("Data: ");
  if (now.day()<=9)
  {
    lcd.print("0");
  }
  lcd.print(now.day(), DEC);
  dayagg=now.day();
  lcd.print("/");
  if (now.month()<=9)
  {
    lcd.print("0");
  }
  lcd.print(now.month(), DEC);
  meseagg=now.month();
  lcd.print("/");
  lcd.print(now.year(), DEC);
  annoagg=now.year();
}

void DisplaySetHour()
{
// time setting
  lcd.clear();
  DateTime now = RTC.now();
  if(digitalRead(P2)==HIGH)
  {
    if(oraagg==23)
    {
      oraagg=0;
    }
    else
    {
      oraagg=oraagg+1;
    }
  }
   if(digitalRead(P3)==HIGH)
  {
    if(oraagg==0)
    {
      oraagg=23;
    }
    else
    {
      oraagg=oraagg-1;
    }
  }
  lcd.setCursor(0,0);
  lcd.print("Imposta Ora:");
  lcd.setCursor(0,1);
  lcd.print(oraagg,DEC);
  delay(200);
}

void DisplaySetMinute()
{
// Setting the minutes
  lcd.clear();
  if(digitalRead(P2)==HIGH)
  {
    if (minagg==59)
    {
      minagg=0;
    }
    else
    {
      minagg=minagg+1;
    }
  }
   if(digitalRead(P3)==HIGH)
  {
    if (minagg==0)
    {
      minagg=59;
    }
    else
    {
      minagg=minagg-1;
    }
  }
  lcd.setCursor(0,0);
  lcd.print("Imposta Minuti:");
  lcd.setCursor(0,1);
  lcd.print(minagg,DEC);
  delay(200);
}
  
void DisplaySetYear()
{
// setting the year
  lcd.clear();
  if(digitalRead(P2)==HIGH)
  {    
    annoagg=annoagg+1;
  }
   if(digitalRead(P3)==HIGH)
  {
    annoagg=annoagg-1;
  }
  lcd.setCursor(0,0);
  lcd.print("Imposta Anno:");
  lcd.setCursor(0,1);
  lcd.print(annoagg,DEC);
  delay(200);
}

void DisplaySetMonth()
{
// Setting the month
  lcd.clear();
  if(digitalRead(P2)==HIGH)
  {
    if (meseagg==12)
    {
      meseagg=1;
    }
    else
    {
      meseagg=meseagg+1;
    }
  }
   if(digitalRead(P3)==HIGH)
  {
    if (meseagg==1)
    {
      meseagg=12;
    }
    else
    {
      meseagg=meseagg-1;
    }
  }
  lcd.setCursor(0,0);
  lcd.print("Imposta Mese:");
  lcd.setCursor(0,1);
  lcd.print(meseagg,DEC);
  delay(200);
}

void DisplaySetDay()
{
// Setting the day
  lcd.clear();
  if(digitalRead(P2)==HIGH)
  {
    if (dayagg==31)
    {
      dayagg=1;
    }
    else
    {
      dayagg=dayagg+1;
    }
  }
   if(digitalRead(P3)==HIGH)
  {
    if (dayagg==1)
    {
      dayagg=31;
    }
    else
    {
      dayagg=dayagg-1;
    }
  }
  lcd.setCursor(0,0);
  lcd.print("Imposta Giorno:");
  lcd.setCursor(0,1);
  lcd.print(dayagg,DEC);
  delay(200);
}

void StoreAgg()
{
// Variable saving
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("SALVATAGGIO IN");
  lcd.setCursor(0,1);
  lcd.print("CORSO");
  RTC.adjust(DateTime(annoagg,meseagg,dayagg,oraagg,minagg,0));
  delay(200);
}
void HourClock()
{
  DateTime now = RTC.now();
  int timeMin = now.minute();
  int modMin = timeMin % 5;  // https://www.arduino.cc/en/Reference/Modulo
  int ora = now.hour() ;
  if ( timeMin >= 40){ // from the 40 minutes, add 1 to "hour"
    ora  = ora+1 ;
  }
 switch (ora ) { 
    case 0:
    case 12: 
    case 24:
        paintWord(txtUNDICI, Off);
            strip.show();
        if ( modMin == 0){
            paintWord(txtDODOCI, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtDODOCI, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtDODOCI, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtDODOCI, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtDODOCI, Red);
            strip.show();
        }
        
break;
    case 1:
    case 13:
        paintWord(txtDODOCI, Off);
            strip.show();
        
        if ( modMin == 0){
            paintWord(txtUNA, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtUNA, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtUNA, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtUNA, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtUNA, Red);
            strip.show();
        }
        
       
break;
    case 2:
    case 14:
        paintWord(txtUNA, Off);
            strip.show();
        
        if ( modMin == 0){
            paintWord(txtDUE, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtDUE, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtDUE, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtDUE, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtDUE, Red);
            strip.show();
        }
break;
    case 3:
    case 15:
        
        paintWord(txtDUE, Off);
            strip.show();
        
        if ( modMin == 0){
            paintWord(txtTRE, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtTRE, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtTRE, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtTRE, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtTRE, Red);
            strip.show();
        }
        
break;
    case 4:
    case 16:
       
        paintWord(txtTRE, Off);
            strip.show();
        
        if ( modMin == 0){
            paintWord(txtQUATTRO, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtQUATTRO, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtQUATTRO, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtQUATTRO, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtQUATTRO, Red);
            strip.show();
        }
        
break;
    case 5:
    case 17:
       
        paintWord(txtQUATTRO, Off);
            strip.show();
        
        if ( modMin == 0){
            paintWord(txtCINQUE, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtCINQUE, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtCINQUE, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtCINQUE, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtCINQUE, Red);
            strip.show();
        }
       
break;
    case 6:
    case 18:
        
        paintWord(txtCINQUE, Off);
            strip.show();
        
        if ( modMin == 0){
            paintWord(txtSEI, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtSEI, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtSEI, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtSEI, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtSEI, Red);
            strip.show();
        }
        
break;
    case 7:
    case 19:
       
        paintWord(txtSEI, Off);
            strip.show();
        
        if ( modMin == 0){
            paintWord(txtSETTE, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtSETTE, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtSETTE, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtSETTE, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtSETTE, Red);
            strip.show();
        }
       
break;
    case 8:
    case 20:
        
        paintWord(txtSETTE, Off);
            strip.show();
        
        if ( modMin == 0){
            paintWord(txtOTTO, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtOTTO, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtOTTO, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtOTTO, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtOTTO, Red);
            strip.show();
        }
       
break;
    case 9:
    case 21:
       
        paintWord(txtOTTO, Off);
            strip.show();
        
        if ( modMin == 0){
            paintWord(txtNOVE, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtNOVE, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtNOVE, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtNOVE, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtNOVE, Red);
            strip.show();
        }
        
break;
    case 10:
    case 22:
  
        paintWord(txtNOVE, Off);
            strip.show();
        
        if ( modMin == 0){
            paintWord(txtDIECI, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtDIECI, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtDIECI, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtDIECI, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtDIECI, Red);
            strip.show();
        }
        
break;
    case 11:
    case 23:
       
        paintWord(txtDIECI, Off);
            strip.show();
        
        if ( modMin == 0){
            paintWord(txtUNDICI, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtUNDICI, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtUNDICI, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtUNDICI, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtUNDICI, Red);
            strip.show();
        }
break;
    }
}
void MinuteClock()
{
  DateTime now = RTC.now();
  int timeMin = now.minute();
  int modMin = timeMin % 5; // https://www.arduino.cc/en/Reference/Modulo
  switch (now.minute()) { 
    case 5:
    case 6:
    case 7:
    case 8:
    case 9:

        if ( modMin == 0){
            paintWord(txtE, White);
            paintWord(txtMCINQUE, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtE, Yellow);
            paintWord(txtMCINQUE, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtE, Green);
            paintWord(txtMCINQUE, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtE, Blue);
            paintWord(txtMCINQUE, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtE, Red);
            paintWord(txtMCINQUE, Red);
            strip.show();
        }
break;


    case 10:
    case 11:
    case 12:
    case 13:
    case 14:
        paintWord(txtMCINQUE, Off);
        strip.show();
        if ( modMin == 0){
            paintWord(txtE, White);
            paintWord(txtMDIECI, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtE, Yellow);
            paintWord(txtMDIECI, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtE, Green);
            paintWord(txtMDIECI, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtE, Blue);
            paintWord(txtMDIECI, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtE, Red);
            paintWord(txtMDIECI, Red);
            strip.show();
        }
        
break;

    case 15:
    case 16:
    case 17:
    case 18:
    case 19:
        paintWord(txtMDIECI, Off);
            strip.show();      
        if ( modMin == 0){
            paintWord(txtE, White);
            paintWord(txtQUINDICI, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtE, Yellow);
            paintWord(txtQUINDICI, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtE, Green);
            paintWord(txtQUINDICI, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtE, Blue);
            paintWord(txtQUINDICI, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtE, Red);
            paintWord(txtQUINDICI, Red);
            strip.show();
        }
break;


    case 20:
    case 21:
    case 22:
    case 23:
    case 24:
        paintWord(txtQUINDICI, Off);
            strip.show();      
        if ( modMin == 0){
            paintWord(txtE, White);
            paintWord(txtVENTI, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtE, Yellow);
            paintWord(txtVENTI, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtE, Green);
            paintWord(txtVENTI, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtE, Blue);
            paintWord(txtVENTI, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtE, Red);
            paintWord(txtVENTI, Red);
            strip.show();
        }
break;

    case 25:
    case 26:
    case 27:
    case 28:
    case 29:
             
        if ( modMin == 0){
            paintWord(txtE, White);
            paintWord(txtVENTI, White);
            paintWord(txtMCINQUE, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtE, Yellow);
            paintWord(txtVENTI, Yellow);
            paintWord(txtMCINQUE, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtE, Green);
            paintWord(txtVENTI, Green);
            paintWord(txtMCINQUE, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtE, Blue);
            paintWord(txtVENTI, Blue);
            paintWord(txtMCINQUE, Blue);
            strip.show();
        }
         else if ( modMin == 4){
            paintWord(txtE, Red);
            paintWord(txtVENTI, Red);
            paintWord(txtMCINQUE, Red);
            strip.show();
        }
break;

    case 30:
    case 31:
    case 32:
    case 33:
    case 34:
        paintWord(txtVENTI, Off); 
        paintWord(txtMCINQUE, Off);   
            strip.show(); 
        if ( modMin == 0){
            paintWord(txtE, White);
            paintWord(txtTRENTA, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtE, Yellow);
            paintWord(txtTRENTA, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtE, Green);
            paintWord(txtTRENTA, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtE, Blue);
            paintWord(txtTRENTA, Blue);
            strip.show();
        }
         else if ( modMin == 4){
            paintWord(txtE, Red);
            paintWord(txtTRENTA, Red);
            strip.show();
        }
break;

    case 35:
    case 36:
    case 37:
    case 38:
    case 39:
        if ( modMin == 0){
            paintWord(txtE, White);
            paintWord(txtTRENTA, White);
            paintWord(txtMCINQUE, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtE, Yellow);
            paintWord(txtTRENTA, Yellow);
            paintWord(txtMCINQUE, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtE, Green);
            paintWord(txtTRENTA, Green);
            paintWord(txtMCINQUE, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtE, Blue);
            paintWord(txtTRENTA, Blue);
            paintWord(txtMCINQUE, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtE, Red);
            paintWord(txtTRENTA, Red);
            paintWord(txtMCINQUE, Red);
            strip.show();
        }
break;

    case 40:
    case 41:
    case 42:
    case 43:
    case 44:
        paintWord(txtE, Off);
        paintWord(txtTRENTA, Off);
        paintWord(txtMCINQUE, Off);    
            strip.show();  
        if ( modMin == 0){
            paintWord(txtMENO, White);  //from the 40 minutes, add 1 to "now" and Printing "meno"
            paintWord(txtVENTI, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtMENO, Yellow);
            paintWord(txtVENTI, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtMENO, Green);
            paintWord(txtVENTI, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtMENO, Blue);
            paintWord(txtVENTI, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtMENO, Red);
            paintWord(txtVENTI, Red);
            strip.show();
        }
break;

    case 45:
    case 46:
    case 47:
    case 48:
    case 49:
        paintWord(txtVENTI, Off);
            strip.show();      
        if ( modMin == 0){
            paintWord(txtMENO, White);
            paintWord(txtQUINDICI, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtMENO, Yellow);
            paintWord(txtQUINDICI, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtMENO, Green);
            paintWord(txtQUINDICI, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtMENO, Blue);
            paintWord(txtQUINDICI, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtMENO, Red);
            paintWord(txtQUINDICI, Red);
            strip.show();
        }
break;

    case 50:
    case 51:
    case 52:
    case 53:
    case 54:
        paintWord(txtQUINDICI, Off);
            strip.show();      
        if ( modMin == 0){
            paintWord(txtMENO, White);
            paintWord(txtMDIECI, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtMENO, Yellow);
            paintWord(txtMDIECI, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtMENO, Green);
            paintWord(txtMDIECI, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtMENO, Blue);
            paintWord(txtMDIECI, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtMENO, Red);
            paintWord(txtMDIECI, Red);
            strip.show();
        }
break;

    case 55:
    case 56:
    case 57:
    case 58:
    case 59:
      
        paintWord(txtMDIECI, Off);
            strip.show();      
        if ( modMin == 0){
            paintWord(txtMENO, White);
            paintWord(txtMCINQUE, White);
            strip.show();
        }
        else if ( modMin == 1){
            paintWord(txtMENO, Yellow);
            paintWord(txtMCINQUE, Yellow);
            strip.show();
        }
        else if ( modMin == 2){
            paintWord(txtMENO, Green);
            paintWord(txtMCINQUE, Green);
            strip.show();
        }
        else if ( modMin == 3){
            paintWord(txtMENO, Blue);
            paintWord(txtMCINQUE, Blue);
            strip.show();
        }
        else if ( modMin == 4){
            paintWord(txtMENO, Red);
            paintWord(txtMCINQUE, Red);
            strip.show();
        }
break;

    case 0:
    case 1:
    case 2:
    case 3:
    case 4:
        paintWord(txtMENO, Off);      
        paintWord(txtMCINQUE, Off);
            strip.show();
break;
    }
}
void paintWord(int arrWord[], uint32_t intColor){
    for(int i = 0; i < strip.numPixels() + 1; i++){
        if(arrWord[i] == -1){
            strip.show();
        break;
        }
        else{
            strip.setPixelColor(arrWord[i],intColor);
        }
    }
}

Italian WordClock

Credits

Tittiamo

Tittiamo

6 projects • 30 followers
Passionate about electronics and Arduino
Contact

Comments