Project Timer with DS1307 - Array of TimeElements; - Is Possible ?

Ok was to long I will split in 2 part :slight_smile:

1°st part:

#include <Time.h>
#include <TimeAlarms.h>
#include <LiquidCrystal.h>	// ensure that the include path is set
#include "M2tk.h"
#include <VirtualWire.h>
#include <Wire.h>
#include <DS1307.h>
#include <EEPROM.h>
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif

//Variabili Globali
char dev;
char testo[15];

// usata per mandare il messaggio
char messaggio[15];
// usato nell'index del close del keypad
int ind = 0;
// usato nel keypad
char Tasto;
// usato nel keyoad
unsigned long UltimoTasto = 0;
// usato nel nella procedura seriale
String LeggiStringa;
byte memoria[105];

uint8_t TimerWakeup0;  // serve per controllare se il timer è enable/disable
uint8_t StartTimer0;   // serve per controllare se è stato attivato il primo timer
uint8_t StopTimer0;    // serve per controllare se è stato attivato il secondo timer

TimeElements tm0start;
TimeElements tm0stop;
TimeElements tm1start;
TimeElements tm1stop;
TimeElements tm2start;
TimeElements tm2stop;
TimeElements tm3start;
TimeElements tm3stop;
TimeElements tm4start;
TimeElements tm4stop;
TimeElements tm5start;
TimeElements tm5stop;
TimeElements tm6start;
TimeElements tm6stop;
TimeElements tm7start;
TimeElements tm7stop;

void LeggiEeprom()
{
  int ind;
   for (ind =0; ind <= 105 ; ind++)
      {
        memoria[ind] = EEPROM.read(ind);
      }   
}

void FaiTempo0()
{
   // make time stop timer 1
 TimerWakeup0 = memoria[0];
 tm0start.Hour =   memoria[2];  
 tm0start.Minute = memoria[3];
 tm0start.Second = 00;
 tm0start.Day =   memoria[4];
 tm0start.Month = memoria[5];
 tm0start.Year = (memoria[6]+2000) - 1970;
 StartTimer0 = memoria[7];
 
 // make time stop timer 0 
 tm0stop.Hour =   memoria[8];
 tm0stop.Minute = memoria[8];
 tm0stop.Second = 00;
 tm0stop.Day =   memoria[10];
 tm0stop.Month = memoria[11];
 tm0stop.Year = (memoria[12]+2000) - 1970;
 StopTimer0 = memoria[13];
}

void Timer()
{
   
     FaiTempo0();
      Alarm.triggerOnce(makeTime(tm0start), FunctionStartTimer0);
     if (TimerWakeup0 == 1) 
      {
        if (StartTimer0 == 0)
         {
          Alarm.triggerOnce(makeTime(tm0start), FunctionStartTimer0); 
          memoria[7] = 1;
          EEPROM.write(7, memoria[7]);
          
         }
         else
          {    
             if (StopTimer0 == 0);
              {
                Alarm.triggerOnce(makeTime(tm0stop), FunctionStopTimer0); 
                
                memoria[13] = 1;
                memoria[0] = 0;
               
                EEPROM.write(13, memoria[13]);
                EEPROM.write(0, memoria[0]);
                }   
            }  
       
           }
}


void FunctionStartTimer0()
{
  messaggio[0]='1';
  messaggio[1]='0';
  messaggio[2]='#';
  Serial.println("Start Timer 0");
  // TxMsg(messaggio);
  
}

void FunctionStopTimer0()
{
  messaggio[0]='*';
  messaggio[1]='0';
  messaggio[2]='#';
  Serial.println("Stop Timer 0");
  // TxMsg(messaggio);
  
}

now will continue with the second one :