AcquaPortal Forum Acquario Dolce e Acquario Marino

AcquaPortal Forum Acquario Dolce e Acquario Marino (http://www.acquariofilia.biz/forum.php)
-   Fai da te marino (http://www.acquariofilia.biz/forumdisplay.php?f=60)
-   -   aiuto a programmare arduino mega 2560 (http://www.acquariofilia.biz/showthread.php?t=449320)

marco3020 23-02-2014 15:27

aiuto a programmare arduino mega 2560
 
Buongiorno a tutti sto finendo una plafoniera che è controllata da arduino ma non so scrivere il programma chi mi aiuta? la plafoniera ha 9 canali e devo farli fare ste cose: alba e tramonto, data e ora, temperatura plafo per accensione ventole, e con il tastierino devo aumentare e abbassare ore luce e intensità. grazie a tutti in anticipo

Sandro S. 03-03-2014 10:37

prova a vedere negli articoli sul Portale, magari ti aiutano, ci sono alcuni esempi.

marco3020 19-07-2014 12:49

ho cercato invano nessun programma adatto a me :( aiutatemi per favore :(

mello85 19-07-2014 13:34

Perdonami ma se non sei esperto di elettronica/programmazione lascia perdere. Vai dietro alla corrente di casa che ha un voltaggio elevato, se non sai quello che fai vai incontro a diversi pericoli! E comunque in rete esistono tanti progetti già fatti, guarda su youtube!


Inviato dal mio iPhone utilizzando Tapatalk

marco3020 19-07-2014 13:45

mi serve lo sketch per favore

Niko79 21-07-2014 13:13

Se conosci almeno le basi della programmazione arduino, per gestire alba e tramonto potresti utilizzare la classe che ho creato qualche tempo fa:

Classe gestione plafoniera

SirNino 21-07-2014 13:28

Quote:

Originariamente inviata da marco3020 (Messaggio 1062450946)
mi serve lo sketch per favore

Scusa @marco3020 ma forse sarebbe meglio se abbozzassi tu il primo sketch e poi lo posti, così possiamo guardarlo e correggerlo insieme.
per me se dici: deve fare alba e tramonto e orologio e non riesci a mettere giu un minimo di programma è perchè ti mancano le basi...quindi cerchi qualcuno che lo faccia per te, non ci sono problemi ma almeno dillo. IMHO
Poi cosa usi? Hai un display?quale?
hai dell'ulteriore hw?quale?
almeno metti in condizione chi ti può aiutare, di farlo.

marco3020 21-07-2014 13:45

Grz quello che mi serviva :) ora mi serve capire come fare 8 canali e come dirli di accendere le ventole quando serve grz
------------------------------------------------------------------------
Allora io ho un semplice display lcd 16x2 rtc ds1307, 7 pulsanti da collegare con il display per comandare le cose da display

marco3020 22-07-2014 10:30

buongiorno su internet ho trovato questo chi mi aiuta sistemarlo per poterlo usare a mio piacimento?



include the libraries:
#include <LiquidCrystal.h>
#include <Wire.h>
#include <Button.h>
#include <EEPROM.h>
#include <EEPROMVar.h>


/**** Define Variables & Constants ****/
/**************************************/

// set the RTC's I2C address
#define DS1307_I2C_ADDRESS 0x68
// create the LCD
LiquidCrystal lcd(8, 7, 5, 4, 16, 2);
// set up backlight
int bkl = 6; // backlight pin
byte bklIdle = 10; // PWM value for backlight at idle
byte bklOn = 70; // PWM value for backlight when on
int bklDelay = 10000; // ms for the backlight to idle before turning off
unsigned long bklTime = 0; // counter since backlight turned on
// create the menu counter
int menuCount = 1;
int menuSelect = 0;

//create the plus and minus navigation delay counter with its initial maximum of 250.
byte btnMaxDelay = 200;
byte btnMinDelay = 25;
byte btnMaxIteration = 5;
byte btnCurrIteration;

//create manual override variables
boolean override = false;
byte overmenu = 0;
int overpercent = 0;

// create the buttons
Button menu = Button(12,PULLDOWN);
Button select = Button(13,PULLDOWN);
Button plus = Button(14,PULLDOWN);
Button minus = Button(15,PULLDOWN);

// LED variables. These control the behavior of lighting. Change these to customize behavoir
int minCounter = 0; // counter that resets at midnight.
int oldMinCounter = 0; // counter that resets at midnight.
int oneLed = 9; // pin for channel 1
int twoLed = 10; // pin for channel 2
int threeLed = 11; // pin for channel 3
int fourLed = 3; // pin for channel 4

int oneVal = 0; // current value for channel 1
int twoVal = 0; // current value for channel 2
int threeVal = 0; // current value for channel 3
int fourVal = 0; // current value for channel 4

// Variables making use of EEPROM memory:

EEPROMVar<int> oneStartMins = 750; // minute to start this channel.
EEPROMVar<int> onePhotoPeriod = 720; // photoperiod in minutes for this channel.
EEPROMVar<int> oneMax = 100; // max intensity for this channel, as a percentage
EEPROMVar<int> oneFadeDuration = 60; // duration of the fade on and off for sunrise and sunset for
// this channel.
EEPROMVar<int> twoStartMins = 810;
EEPROMVar<int> twoPhotoPeriod = 600;
EEPROMVar<int> twoMax = 100;
EEPROMVar<int> twoFadeDuration = 60;

EEPROMVar<int> threeStartMins = 810;
EEPROMVar<int> threePhotoPeriod = 600;
EEPROMVar<int> threeMax = 100;
EEPROMVar<int> threeFadeDuration = 60;

EEPROMVar<int> fourStartMins = 480;
EEPROMVar<int> fourPhotoPeriod = 510;
EEPROMVar<int> fourMax = 100;
EEPROMVar<int> fourFadeDuration = 60;

// variables to invert the output PWM signal,
// for use with drivers that consider 0 to be "on"
// i.e. buckpucks. If you need to provide an inverted
// signal on any channel, set the appropriate variable to true.
boolean oneInverted = false;
boolean twoInverted = false;
boolean threeInverted = false;
boolean fourInverted = false;

/*
int oneStartMins = 1380; // minute to start this channel.
int onePhotoPeriod = 120; // photoperiod in minutes for this channel.
int oneMax = 100; // max intensity for this channel, as a percentage
int oneFadeDuration = 60; // duration of the fade on and off for sunrise and sunset for
// this channel.
int twoStartMins = 800;
int twoPhotoPeriod = 60;
int twoMax = 100;
int twoFadeDuration = 15;

int threeStartMins = 800;
int threePhotoPeriod = 60;
int threeMax = 100;
int threeFadeDuration = 30;

int fourStartMins = 800;
int fourPhotoPeriod = 120;
int fourMax = 100;
int fourFadeDuration = 60;
*/

/****** RTC Functions ******/
/***************************/

// Convert decimal numbers to binary coded decimal
byte decToBcd(byte val)
{
return ( (val/10*16) + (val%10) );
}

// Convert binary coded decimal to decimal numbers
byte bcdToDec(byte val)
{
return ( (val/16*10) + (val%16) );
}

// Sets date and time, starts the clock
void setDate(byte second, // 0-59
byte minute, // 0-59
byte hour, // 1-23
byte dayOfWeek, // 1-7
byte dayOfMonth, // 1-31
byte month, // 1-12
byte year) // 0-99
{
Wire.beginTransmission(DS1307_I2C_ADDRESS);
Wire.send(0);
Wire.send(decToBcd(second));
Wire.send(decToBcd(minute));
Wire.send(decToBcd(hour));
Wire.send(decToBcd(dayOfWeek));
Wire.send(decToBcd(dayOfMonth));
Wire.send(decToBcd(month));
Wire.send(decToBcd(year));
Wire.endTransmission();
}

// Gets the date and time
void getDate(byte *second,
byte *minute,
byte *hour,
byte *dayOfWeek,
byte *dayOfMonth,
byte *month,
byte *year)
{
Wire.beginTransmission(DS1307_I2C_ADDRESS);
Wire.send(0);
Wire.endTransmission();
Wire.requestFrom(DS1307_I2C_ADDRESS, 7);
*second = bcdToDec(Wire.receive() & 0x7f);
*minute = bcdToDec(Wire.receive());
*hour = bcdToDec(Wire.receive() & 0x3f);
*dayOfWeek = bcdToDec(Wire.receive());
*dayOfMonth = bcdToDec(Wire.receive());
*month = bcdToDec(Wire.receive());
*year = bcdToDec(Wire.receive());
}

/****** LED Functions ******/
/***************************/
//function to set LED brightness according to time of day
//function has three equal phases - ramp up, hold, and ramp down

int setLed(int mins, // current time in minutes
int ledPin, // pin for this channel of LEDs
int start, // start time for this channel of LEDs
int period, // photoperiod for this channel of LEDs
int fade, // fade duration for this channel of LEDs
int ledMax, // max value for this channel
boolean inverted // true if the channel is inverted
) {
int val = 0;

//fade up
if (mins > start || mins <= start + fade) {
val = map(mins - start, 0, fade, 0, ledMax);
}
//fade down
if (mins > start + period - fade && mins <= start + period) {
val = map(mins - (start + period - fade), 0, fade, ledMax, 0);
}
//off or post-midnight run.
if (mins <= start || mins > start + period) {
if((start+period)%1440 < start && (start + period)%1440 > mins )
{
val=map((start+period-mins)%1440,0,fade,0,ledMax);
}
else
val = 0;
}


if (val > ledMax) {val = ledMax;}
if (val < 0) {val = 0; }

if (inverted) {analogWrite(ledPin, map(val, 0, 100, 255, 0));}
else {analogWrite(ledPin, map(val, 0, 100, 0, 255));}
if(override){val=overpercent;}
return val;
}

/**** Display Functions ****/
/***************************/

//button hold function
int btnCurrDelay(byte curr)
{
if(curr==btnMaxIteration)
{
btnCurrIteration = btnMaxIteration;
return btnMaxDelay;
}
else if(btnCurrIteration ==0)
{
return btnMinDelay;
}
else
{
btnCurrIteration--;
return btnMaxDelay;
}
}

// format a number of minutes into a readable time (24 hr format)
void printMins(int mins, //time in minutes to print
boolean ampm //print am/pm?
) {
int hr = (mins%1440)/60;
int mn = mins%60;
if(hr<10){
lcd.print(" ");
}
lcd.print(hr);
lcd.print(":");
if(mn<10){
lcd.print("0");
}
lcd.print(mn);
}

// format hours, mins, secs into a readable time (24 hr format)
void printHMS (byte hr,
byte mn,
byte sec //time to print
)
{

if(hr<10){
lcd.print(" ");
}
lcd.print(hr, DEC);
lcd.print(":");
if(mn<10){
lcd.print("0");
}
lcd.print(mn, DEC);
lcd.print(":");
if(sec<10){
lcd.print("0");
}
lcd.print(sec, DEC);
}
void ovrSetAll(int pct){
analogWrite(oneLed,map(pct,0,100,0,255));
analogWrite(twoLed,map(pct,0,100,0,255));
analogWrite(threeLed,map(pct,0,100,0,255));
analogWrite(fourLed,map(pct,0,100,0,255));
}

/**** Setup ****/
/***************/

void setup() {
Wire.begin();
pinMode(bkl, OUTPUT);
lcd.begin(16, 2);
digitalWrite(bkl, HIGH);
lcd.print("Matteo-Reef");
lcd.setCursor(0,1);
lcd.print("");
delay(5000);
lcd.clear();
analogWrite(bkl,bklIdle);
btnCurrIteration = btnMaxIteration;
}

/***** Loop *****/
/****************/

void loop() {
byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;

getDate(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);
oldMinCounter = minCounter;
minCounter = hour * 60 + minute;

//reset plus & minus acceleration counters if the button's state has changed
if(plus.stateChanged())
{
btnCurrDelay(btnMaxIteration);
}
if(minus.stateChanged())
{
btnCurrDelay(btnMaxIteration);
}


//check & set fade durations
if(oneFadeDuration > onePhotoPeriod/2 && onePhotoPeriod >0){oneFadeDuration = onePhotoPeriod/2;}
if(oneFadeDuration<1){oneFadeDuration=1;}

if(twoFadeDuration > twoPhotoPeriod/2 && twoPhotoPeriod >0){twoFadeDuration = twoPhotoPeriod/2;}
if(twoFadeDuration<1){twoFadeDuration=1;}

if(threeFadeDuration > threePhotoPeriod/2 && threePhotoPeriod >0){threeFadeDuration = threePhotoPeriod/2;}
if(threeFadeDuration<1){threeFadeDuration=1;}

if(fourFadeDuration > fourPhotoPeriod/2 && fourPhotoPeriod > 0){fourFadeDuration = fourPhotoPeriod/2;}
if(fourFadeDuration<1){fourFadeDuration=1;}

//check & set any time functions


//set outputs
if(!override){
oneVal = setLed(minCounter, oneLed, oneStartMins, onePhotoPeriod, oneFadeDuration, oneMax, oneInverted);
twoVal = setLed(minCounter, twoLed, twoStartMins, twoPhotoPeriod, twoFadeDuration, twoMax, twoInverted);
threeVal = setLed(minCounter, threeLed, threeStartMins, threePhotoPeriod, threeFadeDuration, threeMax, threeInverted);
fourVal = setLed(minCounter, fourLed, fourStartMins, fourPhotoPeriod, fourFadeDuration, fourMax, fourInverted);
}
else{
ovrSetAll(overpercent);
}


//turn the backlight off and reset the menu if the idle time has elapsed
if(bklTime + bklDelay < millis() && bklTime > 0 ){
analogWrite(bkl,bklIdle);
menuCount = 1;
lcd.clear();
bklTime = 0;
}

//iterate through the menus
if(menu.uniquePress()){
analogWrite(bkl,bklOn);
bklTime = millis();
if(menuCount < 20){
menuCount++;
}else {
menuCount = 1;
}
lcd.clear();
}
if(menuCount == 1){
//main screen turn on!!!
if (minCounter > oldMinCounter){
lcd.clear();
}
lcd.setCursor(0,0);
printHMS(hour, minute, second);
lcd.setCursor(0,1);
lcd.print(oneVal);
lcd.setCursor(4,1);
lcd.print(twoVal);
lcd.setCursor(8,1);
lcd.print(threeVal);
lcd.setCursor(12,1);
lcd.print(fourVal);
//debugging function to use the select button to advance the timer by 1 minute
//if(select.uniquePress()){setDate(second, minute+1, hour, dayOfWeek, dayOfMonth, month, year);}
}

if(menuCount == 2){
//Manual Override Menu
lcd.setCursor(0,0);
lcd.print("Manual Overrides");
lcd.setCursor(0,1);
lcd.print("All: ");
if(select.uniquePress()){
if(menuSelect < 3){menuSelect++;}
else{menuSelect = 0;}
bklTime = millis();
}

if(menuSelect == 0){
lcd.print("Timer");
override = false;}
if(menuSelect == 1){
lcd.print("ON ");
overpercent = 100;
override = true;}
if(menuSelect == 2){
lcd.print("OFF ");
overpercent = 0;
override = true;}
if(menuSelect == 3){
override = true;
lcd.print(overpercent,DEC);
lcd.print("% ");
if(plus.isPressed() && overpercent <100)
{
overpercent++;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}

if(minus.isPressed() && overpercent > 0)
{
overpercent--;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
}
}



if(menuCount == 3){
//set start time for channel one
lcd.setCursor(0,0);
lcd.print("Channel 1 Start");
lcd.setCursor(0,1);
printMins(oneStartMins, true);

if(plus.isPressed() && oneStartMins < 1440){
oneStartMins++;
if(onePhotoPeriod >0){onePhotoPeriod--;}
else{onePhotoPeriod=1439;}
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
if(minus.isPressed() && oneStartMins > 0){
oneStartMins--;
if(onePhotoPeriod<1439){onePhotoPeriod++;}
else{onePhotoPeriod=0;}
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
}

if(menuCount == 4){
//set end time for channel one
lcd.setCursor(0,0);
lcd.print("Channel 1 End");
lcd.setCursor(0,1);
printMins(oneStartMins+onePhotoPeriod, true);
if(plus.isPressed()){
if(onePhotoPeriod < 1439){
onePhotoPeriod++;}
else{
onePhotoPeriod=0;
}
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
if(minus.isPressed()){
if(onePhotoPeriod >0){
onePhotoPeriod--;}
else{
onePhotoPeriod=1439;
}
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
}

if(menuCount == 5){
//set fade duration for channel one
lcd.setCursor(0,0);
lcd.print("Channel 1 Fade");
lcd.setCursor(0,1);
printMins(oneFadeDuration, false);
if(plus.isPressed() && (oneFadeDuration < onePhotoPeriod/2 || oneFadeDuration == 0)){
oneFadeDuration++;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
if(minus.isPressed() && oneFadeDuration > 1){
oneFadeDuration--;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
}

if(menuCount == 6){
//set intensity for channel one
lcd.setCursor(0,0);
lcd.print("Channel 1 Max");
lcd.setCursor(1,1);
lcd.print(oneMax);
lcd.print(" ");
if(plus.isPressed() && oneMax < 100){
oneMax++;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
if(minus.isPressed() && oneMax > 0){
oneMax--;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
}

if(menuCount == 7){
//set start time for channel two
lcd.setCursor(0,0);
lcd.print("Channel 2 Start");
lcd.setCursor(0,1);
printMins(twoStartMins, true);
if(plus.isPressed() && twoStartMins < 1440){
twoStartMins++;
if(twoPhotoPeriod >0){twoPhotoPeriod--;}
else{twoPhotoPeriod=1439;}
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
if(minus.isPressed() && twoStartMins > 0){
twoStartMins--;
if(twoPhotoPeriod<1439){twoPhotoPeriod++;}
else{twoPhotoPeriod=0;}
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
}

if(menuCount == 8){
//set end time for channel two
lcd.setCursor(0,0);
lcd.print("Channel 2 End");
lcd.setCursor(0,1);
printMins(twoStartMins+twoPhotoPeriod, true);
if(plus.isPressed()){
if(twoPhotoPeriod < 1439){
twoPhotoPeriod++;}
else{
twoPhotoPeriod=0;
}
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
if(minus.isPressed()){
if(twoPhotoPeriod >0){
twoPhotoPeriod--;}
else{
twoPhotoPeriod=1439;
}
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
}

if(menuCount == 9){
//set fade duration for channel two
lcd.setCursor(0,0);
lcd.print("Channel 2 Fade");
lcd.setCursor(0,1);
printMins(twoFadeDuration, false);
if(plus.isPressed() && (twoFadeDuration < twoPhotoPeriod/2 || twoFadeDuration == 0)){
twoFadeDuration++;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
if(minus.isPressed() && twoFadeDuration > 1){
twoFadeDuration--;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
}

if(menuCount == 10){
//set intensity for channel two
lcd.setCursor(0,0);
lcd.print("Channel 2 Max");
lcd.setCursor(1,1);
lcd.print(twoMax);
lcd.print(" ");
if(plus.isPressed() && twoMax < 100){
twoMax++;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
if(minus.isPressed() && twoMax > 0){
twoMax--;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
}

if(menuCount == 11){
//set start time for channel three
lcd.setCursor(0,0);
lcd.print("Channel 3 Start");
lcd.setCursor(0,1);
printMins(threeStartMins, true);
if(plus.isPressed() && threeStartMins < 1440){
threeStartMins++;
if(threePhotoPeriod >0){threePhotoPeriod--;}
else{threePhotoPeriod=1439;}
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
if(minus.isPressed() && threeStartMins > 0){
threeStartMins--;
if(threePhotoPeriod<1439){threePhotoPeriod++;}
else{threePhotoPeriod=0;}
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
}

if(menuCount == 12){
//set end time for channel three
lcd.setCursor(0,0);
lcd.print("Channel 3 End");
lcd.setCursor(0,1);
printMins(threeStartMins+threePhotoPeriod, true);
if(plus.isPressed()){
if(threePhotoPeriod < 1439){
threePhotoPeriod++;}
else{
threePhotoPeriod=0;
}
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
if(minus.isPressed()){
if(threePhotoPeriod >0){
threePhotoPeriod--;}
else{
threePhotoPeriod=1439;
}
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
}

if(menuCount == 13){
//set fade duration for channel three
lcd.setCursor(0,0);
lcd.print("Channel 3 Fade");
lcd.setCursor(0,1);
printMins(threeFadeDuration, false);
if(plus.isPressed() && (threeFadeDuration < threePhotoPeriod/2 || threeFadeDuration == 0)){
threeFadeDuration++;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
if(minus.isPressed() && threeFadeDuration > 1){
threeFadeDuration--;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
}

if(menuCount == 14){
//set intensity for channel three
lcd.setCursor(0,0);
lcd.print("Channel 3 Max");
lcd.setCursor(1,1);
lcd.print(threeMax);
lcd.print(" ");
if(plus.isPressed() && threeMax < 100){
threeMax++;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
if(minus.isPressed() && threeMax > 0){
threeMax--;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
}

if(menuCount == 15){
//set start time for channel four
lcd.setCursor(0,0);
lcd.print("Channel 4 Start");
lcd.setCursor(0,1);
printMins(fourStartMins, true);
if(plus.isPressed() && fourStartMins < 1440){
fourStartMins++;
if(fourPhotoPeriod >0){fourPhotoPeriod--;}
else{fourPhotoPeriod=1439;}
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
if(minus.isPressed() && fourStartMins > 0){
fourStartMins--;
if(fourPhotoPeriod<1439){fourPhotoPeriod++;}
else{fourPhotoPeriod=0;}
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
}

if(menuCount == 16){
//set end time for channel four
lcd.setCursor(0,0);
lcd.print("Channel 4 End");
lcd.setCursor(0,1);
printMins(fourStartMins+fourPhotoPeriod, true);
if(plus.isPressed()){
if(fourPhotoPeriod < 1439){
fourPhotoPeriod++;}
else{
fourPhotoPeriod=0;
}
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
if(minus.isPressed()){
if(fourPhotoPeriod >0){
fourPhotoPeriod--;}
else{
fourPhotoPeriod=1439;
}
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
}

if(menuCount == 17){
//set fade duration for channel four
lcd.setCursor(0,0);
lcd.print("Channel 4 Fade");
lcd.setCursor(0,1);
printMins(fourFadeDuration, false);
if(plus.isPressed() && (fourFadeDuration < fourPhotoPeriod/2 || fourFadeDuration == 0)){
fourFadeDuration++;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
if(minus.isPressed() && fourFadeDuration > 1){
fourFadeDuration--;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
}

if(menuCount == 18){
//set intensity for channel four
lcd.setCursor(0,0);
lcd.print("Channel 4 Max");
lcd.setCursor(1,1);
lcd.print(fourMax);
lcd.print(" ");
if(plus.isPressed() && fourMax < 100){
fourMax++;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
if(minus.isPressed() && fourMax > 0){
fourMax--;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
}

if(menuCount == 19){
//set hours
lcd.setCursor(0,0);
lcd.print("Set Time: Hrs");
lcd.setCursor(0,1);
printHMS(hour, minute, second);
if(plus.isPressed() && hour < 23){
hour++;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
if(minus.isPressed() && hour > 0){
hour--;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
setDate(second, minute, hour, dayOfWeek, dayOfMonth, month, year);
}

if(menuCount == 20){
//set minutes
lcd.setCursor(0,0);
lcd.print("Set Time: Mins");
lcd.setCursor(0,1);
printHMS(hour, minute, second);
if(plus.isPressed() && minute < 59){
minute++;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
if(minus.isPressed() && minute > 0){
minute--;
delay(btnCurrDelay(btnCurrIteration-1));
bklTime = millis();
}
setDate(second, minute, hour, dayOfWeek, dayOfMonth, month, year);
}
}

marco3020 22-07-2014 17:48

up

marco3020 23-07-2014 09:08

up, qualcuno mi aiuta?

marco3020 24-07-2014 14:05

c'e qualche cristiano che può aiutarmi? :((

Sandro S. 24-07-2014 14:09

improbabile marco, non sono in molti a scrivere codice per arduino sul forum che andrebbe poi anche testato.

io stesso ho arduino ma sono alle "prime armi", per ora ho fatto questo con valori random dato che per ora non ho ancora la vasca, ma cmq cambia poco, leggere da un sonda l'ho già testato.

se e quando saremo di più proveremo magari ad aprire una sezione nel forum dedicata.

http://s24.postimg.cc/4vrfd0hj9/image.png

marco3020 24-07-2014 14:53

qualcuno c'e aveva pure scritto nel post poi sparito

SirNino 24-07-2014 16:56

Marco se stai parlando di me t'ho anche risposto in MP dandoti i motivi del ritardo. Appena ho un attimo ci guardo. [emoji2]
Però vorrei spiegarti che programmare non è una cosa così semplice e veloce, quindi c'è chi non vuole "regalare" il proprio tempo, c'è chi non è sicuro e preferisce restarne fuori e c'è chi dedica per passione tempo alla programmazione ritagliando il tempo per farlo alla famiglia e a tutti gli altri impegni che ognuno di noi ha.
Io t'ho dato la mia disponibilità vincolata purtroppo al tempo che ho, se questo non bastasse perchè hai bisogno subito ti chiedo scusa per averti rubato tempo.

marco3020 24-07-2014 16:58

Grz mille tranquillo aspetto

SirNino 29-07-2014 13:05

Ciao marco, scrivo solo per rassicurarti, non mi son scordato.
strutturare il menù per 8accensioni separate m'ha dato più problemi del previsto ma ora dovrei aver risolto.
t'ho preparato già la gestione della temperatura (che visto che non avevo capito se ti serviva per raffreddare o scaldare te le ho implementate entrambe).
ora mi rimane solo da sincronizzare gli orari e le rampe dell'alba tramonto e dovrei essere a posto.

marco3020 29-07-2014 13:17

Ti ringrazio molto non so come sdebitarmi

Colaki 30-07-2014 15:28

Vi seguo interessato

SirNino 05-08-2014 21:53

@marco3020 ti chiedo scusa per il ritardo ma ci sono quasi.
Purtroppo il tempo latita causa lavoro ma ci sto lavorando, quando vedrai il codice capirai la causa del ritardo....

marco3020 05-08-2014 21:56

Tranquillo ti ringrazio ancora per il tuo aiuto

SirNino 13-08-2014 16:49

Finalmente è finito
 
Ciao @marco3020 , ciao @Colaki e ciao a tutti quelli che vorranno seguire questa discussione.
Come promesso a Marco ho realizzato il codice da lui richiesto che prevedeva:

- accensione di 8 canali separati ed indipendenti di led
- alba e tramonto per ogni canale
- gestione temperatura (riscaldatore e refrigeratore)

Hardware:

- Arduino Mega 2560 rev.3
- RTC DS1307
- Display LCD 1602
- 6 pulsanti da circuito stampato (sto implementando il settimo per la navigazione del menù --> movimento back)
- 6 resistenze di pulldown (10 KΏ)
- sensore di temperatura
- resistenza variabile (se volete poter regolare la luminosità del vostro LCD)

La cosa, secondo me, più difficile in questa progettazione è stata l'assoluta indipendenza di ogni canale e la possibilità di regolare in maniera diversa ognuno di questi (per ogni canale si può decidere l'orario dell'inizio alba, la durata, l'inizio del tramonto e la durata di quest'ultimo). Quindi se si volesse far accendere prima il sesto canale e poi il primo basterebbe impostarlo così nei relativi campi #70. La gestione del menù ha portato via molto tempo (ci sono più di 100 variabili a definire solo le regolazioni dei canali tra orari durate ecc. oltre alle variabili "di sistema" per gli orari le temperature ed altre cosine.
La temperatura viene rilevata una volta al secondo. Dopo la misurazione questo dato viene passato ad un ciclo di controllo che verifica se la temperatura rientra nei delta impostati, sia per la refrigerazione che per il riscaldamento, rispetto alle temperature di riferimento (a loro volta impostabili da menù.
Durante le prove fatte sulla protoboard, ho notato che se il sensore viene installato troppo vicino ad altri componenti elettronici, risente molto dei campi magnetici emessi, sballando ( a volte anche di 5 - 6°) la temperatura rilevata.

Iniziamo il lavoro vero e proprio modificando la libreria menuBackend.h

aggiungere, alla riga 195 del file MenuBackend.h subito prima della riga con scritto "private:", questo metodo:
codice:

    void toRoot() {
        setCurrent( &getRoot() );
    }

Questo metodo mi serve per poter tornare agevolmente alla radice del menu (all'home).

Ora qualche foto del progetto di prototipazione (vi prego scusate il casino di fili ma durante lo sviluppo ho aggiunto, tolto, spostato e rispostato...risultato....?)

http://s29.postimg.cc/kecqo9qn7/IMG_20140813_162938.jpg http://s8.postimg.cc/ga31t8ixd/IMG_20140813_162950.jpg

http://s13.postimg.cc/adgogl2dv/IMG_20140813_163003.jpg http://s1.postimg.cc/dxepyal2j/IMG_20140813_163018.jpg

a questo punto credo che non manchi più niente...apparte lo il codice #28g

codice:


#include <MenuBackend.h>    //MenuBackend library
#include <LiquidCrystal.h> 
#include <Wire.h>
#include <RTClib.h>

int orario;
char buffer[10];
unsigned long time=0;
unsigned long timeSet=0;
int  setModeTime=2000;
int nMenu=0;                        //  VARIABILE CHE IDENTIFICA IL MENU' IN USO
const int sensorPin=A0;
int temperatura=0.0;
int sensorval=0.0;
float volt=0.0;
float tRisc = 25.0;
float dRisc = 2.0;      //  VARIABILI RISCALDATORE
float tRefrig = 27.0;
float dRefrig = 2.0;    //  VARIABILI REFRIGERATORE

RTC_DS1307 RTC;


const int buttonPinLeft = 22;      // pin Giu
const int buttonPinRight = 24;    // pin Su
const int buttonPinEsc = 28;    // pin Esc
const int buttonPinEnter = 26;  // pin OK
const int buttonPiu = 30;        // pin modifica più
const int buttonMeno = 32;      // pin modifica meno
const int temp = A0;              // pin sensore temperatura
const int refrig = 53;            //  USCITA REFRIGERATORE
const int risc = 51;              //  USCITA RISCALDATORE

///////////////////////////////////////////////////////////////////////////////////////
//                                VARIABILI CANALE 1                                //
int FACH1=5;
int FTCH1=5;        //DURATA ALBA/TRAMONTO ESPRIMERE IN MINUTI
int ACH1h = 12;
int ACH1m = 0;
int TCH1h = 0;
int TCH1m = 0;
const int LED1 = 2;        //  definisce il pin per la prima fila di led
boolean alba1 = true;
boolean tramonto1 = true;
int stepA1 = 0;
int stepA11 = 0;
int stepT1 = 0;
int stepT11 = 0;
char CH1ora[5]="";
int x1=0;
int ACH1timer[] = {
  0, 0};
int TCH1timer[] = {
  0, 0};
///////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////
//                                VARIABILI CANALE 2                                //
int FACH2=5;
int FTCH2=5;        //DURATA ALBA/TRAMONTO ESPRIMERE IN MINUTI
int ACH2h = 12;
int ACH2m = 30;
int TCH2h = 23;
int TCH2m = 30;
const int LED2 = 3;        //  definisce il pin per la seconda fila di led
boolean alba2 = true;
boolean tramonto2 = true;
int stepA2 = 0;
int stepA22 = 0;
int stepT2 = 0;
int stepT22 = 0;
char CH2ora[5]="";
int x2=0;
int CH2timer[] = {
  0, 0};
///////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////
//                                VARIABILI CANALE 3                                //
int FACH3=5;
int FTCH3=5;        //DURATA ALBA/TRAMONTO ESPRIMERE IN MINUTI
int ACH3h = 13;
int ACH3m = 0;
int TCH3h = 23;
int TCH3m = 0;
const int LED3 = 4;        //  definisce il pin per la terza fila di led
boolean alba3 = true;
boolean tramonto3 = true;
int stepA3 = 0;
int stepA33 = 0;
int stepT3 = 0;
int stepT33 = 0;
char CH3ora[5]="";
int x3=0;
int CH3timer[] = {
  0, 0};
///////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////
//                                VARIABILI CANALE 4                                //
int FACH4=5;
int FTCH4=5;        //DURATA ALBA/TRAMONTO ESPRIMERE IN MINUTI
int ACH4h = 13;
int ACH4m = 30;
int TCH4h = 22;
int TCH4m = 30;
const int LED4 = 5;        //  definisce il pin per la quarta fila di led
boolean alba4 = true;
boolean tramonto4 = true;
int stepA4 = 0;
int stepA44 = 0;
int stepT4 = 0;
int stepT44 = 0;
char CH4ora[5]="";
int x4=0;
int CH4timer[] = {
  0, 0};
///////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////
//                                VARIABILI CANALE 5                                //
int FACH5=5;
int FTCH5=5;        //DURATA ALBA/TRAMONTO ESPRIMERE IN MINUTI
int ACH5h = 14;
int ACH5m = 0;
int TCH5h = 22;
int TCH5m = 0;
const int LED5 = 6;        //  definisce il pin per la quinta fila di led
boolean alba5 = true;
boolean tramonto5 = true;
int stepA5 = 0;
int stepA55 = 0;
int stepT5 = 0;
int stepT55 = 0;
char CH5ora[5]="";
int x5=0;
int CH5timer[] = {
  0, 0};
///////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////
//                                VARIABILI CANALE 6                                //
int FACH6=5;
int FTCH6=5;        //DURATA ALBA/TRAMONTO ESPRIMERE IN MINUTI
int ACH6h = 14;
int ACH6m = 30;
int TCH6h = 21;
int TCH6m = 30;
const int LED6 = 7;        //  definisce il pin per la sesta fila di led
boolean alba6 = true;
boolean tramonto6 = true;
int stepA6 = 0;
int stepA66 = 0;
int stepT6 = 0;
int stepT66 = 0;
char CH6ora[5]="";
int x6=0;
int CH6timer[] = {
  0, 0};
///////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////
//                                VARIABILI CANALE 7                                //
int FACH7=5;
int FTCH7=5;        //DURATA ALBA/TRAMONTO ESPRIMERE IN MINUTI
int ACH7h = 15;
int ACH7m = 0;
int TCH7h = 21;
int TCH7m = 0;
const int LED7 = 8;        //  definisce il pin per la settima fila di led
boolean alba7 = true;
boolean tramonto7 = true;
int stepA7 = 0;
int stepA77 = 0;
int stepT7 = 0;
int stepT77 = 0;
char CH7ora[5]="";
int x7=0;
int CH7timer[] = {
  0, 0};
///////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////
//                                VARIABILI CANALE 8                                //
int FACH8=5;
int FTCH8=5;        //DURATA ALBA/TRAMONTO ESPRIMERE IN MINUTI
int ACH8h = 15;
int ACH8m = 30;
int TCH8h = 20;
int TCH8m = 30;
const int LED8 = 9;        //  definisce il pin per l'ottava fila di led
boolean alba8 = true;
boolean tramonto8 = true;
int stepA8 = 0;
int stepA88 = 0;
int stepT8 = 0;
int stepT88 = 0;
char CH8ora[5]="";
int x8=0;
int CH8timer[] = {
  0, 0};
///////////////////////////////////////////////////////////////////////////////////////

int lastButtonPushed = 0;

int lastButtonEnterState = LOW; 
int lastButtonEscState = LOW; 
int lastButtonLeftState = LOW; 
int lastButtonRightState = LOW; 


long lastEnterDebounceTime = 0;
long lastEscDebounceTime = 0; 
long lastLeftDebounceTime = 0;
long lastRightDebounceTime = 0;
long debounceDelay = 300;    // tempo di rimbalzo


LiquidCrystal lcd(12, 11, 13, 10, 27, 25);

//Variabili del menu
MenuBackend menu = MenuBackend(menuUsed,menuChanged);


//    MENU' ILLUMINAZIONE
MenuItem menu1Item1 = MenuItem("Item1");
MenuItem menuCanale1 = MenuItem("CH1");
MenuItem menuCanale2 = MenuItem("CH2");
MenuItem menuCanale3 = MenuItem("CH3");
MenuItem menuCanale4 = MenuItem("CH4");
MenuItem menuCanale5 = MenuItem("CH5");
MenuItem menuCanale6 = MenuItem("CH6");
MenuItem menuCanale7 = MenuItem("CH7");
MenuItem menuCanale8 = MenuItem("CH8");
MenuItem menuCanale1ACH1=MenuItem("ACH1");
MenuItem menuCanale1FACH1=MenuItem("FACH1");
MenuItem menuCanale1TCH1=MenuItem("TCH1");
MenuItem menuCanale1FTCH1=MenuItem("FTCH1");
MenuItem menuCanale2ACH1=MenuItem("ACH2");
MenuItem menuCanale2FACH1=MenuItem("FACH2");
MenuItem menuCanale2TCH1=MenuItem("TCH2");
MenuItem menuCanale2FTCH1=MenuItem("FTCH2");
MenuItem menuCanale3ACH1=MenuItem("ACH3");
MenuItem menuCanale3FACH1=MenuItem("FACH3");
MenuItem menuCanale3TCH1=MenuItem("TCH3");
MenuItem menuCanale3FTCH1=MenuItem("FTCH3");
MenuItem menuCanale4ACH1=MenuItem("ACH4");
MenuItem menuCanale4FACH1=MenuItem("FACH4");
MenuItem menuCanale4TCH1=MenuItem("TCH4");
MenuItem menuCanale4FTCH1=MenuItem("FTCH4");
MenuItem menuCanale5ACH1=MenuItem("ACH5");
MenuItem menuCanale5FACH1=MenuItem("FACH5");
MenuItem menuCanale5TCH1=MenuItem("TCH5");
MenuItem menuCanale5FTCH1=MenuItem("FTCH5");
MenuItem menuCanale6ACH1=MenuItem("ACH6");
MenuItem menuCanale6FACH1=MenuItem("FACH6");
MenuItem menuCanale6TCH1=MenuItem("TCH6");
MenuItem menuCanale6FTCH1=MenuItem("FTCH6");
MenuItem menuCanale7ACH1=MenuItem("ACH7");
MenuItem menuCanale7FACH1=MenuItem("FACH7");
MenuItem menuCanale7TCH1=MenuItem("TCH7");
MenuItem menuCanale7FTCH1=MenuItem("FTCH7");
MenuItem menuCanale8ACH1=MenuItem("ACH8");
MenuItem menuCanale8FACH1=MenuItem("FACH8");
MenuItem menuCanale8TCH1=MenuItem("TCH8");
MenuItem menuCanale8FTCH1=MenuItem("FTCH8");


//      MENU' TEMPERATURE
MenuItem menu1Item2 = MenuItem("Item2");
MenuItem menuTempRefrig=MenuItem("tRefrig");
MenuItem menuDeltaRefrig=MenuItem("dRefrig");
MenuItem menuTempRisc=MenuItem("tRisc");
MenuItem menuDeltaRisc=MenuItem("dRisc");
MenuItem menuRiscaldatore=MenuItem("Riscaldatore");
MenuItem menuRefrigeratore=MenuItem("Refrigeratore");

//        MENU' IMPOSTAZIONI
MenuItem menu1Item3 = MenuItem("Item3");
MenuItem menuData=MenuItem("Data/Ora");
//MenuItem menuOra=MenuItem("Ora");

void setup(void)
{
  pinMode(buttonPinLeft, INPUT);
  pinMode(buttonPinRight, INPUT);
  pinMode(buttonPinEnter, INPUT);
  pinMode(buttonPinEsc, INPUT);
  pinMode(buttonPiu, INPUT);
  pinMode(buttonMeno, INPUT);
  pinMode(risc, OUTPUT);
  pinMode(refrig, OUTPUT);
  pinMode (LED1, OUTPUT);
  pinMode (LED2, OUTPUT);
  pinMode (LED3, OUTPUT);
  pinMode (LED4, OUTPUT);
  pinMode (LED5, OUTPUT);
  pinMode (LED6, OUTPUT);
  pinMode (LED7, OUTPUT);
  pinMode (LED8, OUTPUT);
  stepA1 = ((FACH1*60000)/255);
  stepT1 = ((FTCH1*60000)/255);
  stepA2 = ((FACH2*60000)/255);
  stepT2 = ((FTCH2*60000)/255);
  stepA3 = ((FACH3*60000)/255);
  stepT3 = ((FTCH3*60000)/255);
  stepA4 = ((FACH4*60000)/255);
  stepT4 = ((FTCH4*60000)/255);
  stepA5 = ((FACH5*60000)/255);
  stepT5 = ((FTCH5*60000)/255);
  stepA6 = ((FACH6*60000)/255);
  stepT6 = ((FTCH6*60000)/255);
  stepA7 = ((FACH7*60000)/255);
  stepT7 = ((FTCH7*60000)/255);
  stepA8 = ((FACH1*60000)/255);
  stepT8 = ((FTCH1*60000)/255);

  Wire.begin();
  RTC.begin();
  lcd.begin(16, 2);

  if (! RTC.isrunning()) {
    Serial.println("RTC is NOT running!");
    RTC.adjust(DateTime(__DATE__, __TIME__));
  }


  menu.getRoot().add(menu1Item1).addRight(menu1Item2).addRight(menu1Item3);
  menu1Item1.add(menuCanale1).addRight(menuCanale2).addRight(menuCanale3).addRight(menuCanale4).addRight(menuCanale5).addRight(menuCanale6).addRight(menuCanale7).addRight(menuCanale8);
  menuCanale1.add(menuCanale1ACH1).addRight(menuCanale1FACH1).addRight(menuCanale1TCH1).addRight(menuCanale1FTCH1);
  menuCanale2.add(menuCanale2ACH1).addRight(menuCanale2FACH1).addRight(menuCanale2TCH1).addRight(menuCanale2FTCH1);
  menuCanale3.add(menuCanale3ACH1).addRight(menuCanale3FACH1).addRight(menuCanale3TCH1).addRight(menuCanale3FTCH1);
  menuCanale4.add(menuCanale4ACH1).addRight(menuCanale4FACH1).addRight(menuCanale4TCH1).addRight(menuCanale4FTCH1);
  menuCanale5.add(menuCanale5ACH1).addRight(menuCanale5FACH1).addRight(menuCanale5TCH1).addRight(menuCanale5FTCH1);
  menuCanale6.add(menuCanale6ACH1).addRight(menuCanale6FACH1).addRight(menuCanale6TCH1).addRight(menuCanale6FTCH1);
  menuCanale7.add(menuCanale7ACH1).addRight(menuCanale7FACH1).addRight(menuCanale7TCH1).addRight(menuCanale7FTCH1);
  menuCanale8.add(menuCanale8ACH1).addRight(menuCanale8FACH1).addRight(menuCanale8TCH1).addRight(menuCanale8FTCH1);
  menu1Item2.add(menuRiscaldatore).addRight(menuRefrigeratore);
  menuRiscaldatore.add(menuTempRisc).addRight(menuDeltaRisc);
  menuRefrigeratore.add(menuTempRefrig).addRight(menuDeltaRefrig);
  menu1Item3.add(menuData); //.addRight(menuOra);
  menu.toRoot();

  pulischermo();

}  // setup()...

void rilevTemp(void){
  sensorval=analogRead(sensorPin);
  volt=((sensorval/1024.0)*5.0);
  temperatura=((volt - .5)*100);
  //delay(5000);

}

void pulischermo(void){


  nMenu=0;
  lcd.clear();
  DateTime now = RTC.now();
  sprintf(buffer,  "%02d/%02d/%d", now.day(), now.month(), now.year());
  lcd.setCursor(0,0);
  lcd.print( buffer );

  char buffer[14] = "";

  sprintf(buffer,  "%02d:%02d", now.hour(), now.minute());
  lcd.setCursor(11,0);
  lcd.print( buffer );
  lcd.setCursor(0,1);
  lcd.print("Temperatura: ");
  lcd.setCursor(13,1);
  lcd.print(temperatura);
  lcd.setCursor(15,1);
  lcd.print(char(223));

}

void setLCD(void){
  lcd.clear();
  lcd.setCursor(0,0);
}

void ach(void){
  setLCD();
  lcd.print("Inizio Alba");
  lcd.setCursor(0,1);
}

void fach(void){
  setLCD();
  lcd.print("Durata Alba");
  lcd.setCursor(4,1);
  lcd.print("min.");
  lcd.setCursor(0,1);
}

void tch(void){
  setLCD();
  lcd.print("Inizio Tramonto");
  lcd.setCursor(0,1);
}

void ftch(void){
  setLCD();
  lcd.print("Durata Tramamont");
  lcd.setCursor(4,1);
  lcd.print("min.");
  lcd.setCursor(0,1);
}

void selOpt(void){
  lcd.setCursor(0,1);
  lcd.print("Selez.Opzioni");
}

Il codice dovrebbe essere tutto commentato (almeno nelle parti importanti) quindi dovrebbe essere di facile comprensione.
Ma per qualsiasi domanda o dubbio non esitate a chiedere.

Spero che vi piaccia....e soprattutto che funzioni!!#rotfl#

Ciao
Alla prossima!!

SirNino 13-08-2014 16:51

1 allegato(i)
Purtroppo ho dovuto "tagliare" in due il codice perché troppo lungo per essere pubblicato intero.

Quello che segue è solo il completamento del codice precedente.

codice:


  void loop(void)
  {
    char buffer[10] = "";
    DateTime now = RTC.now();
    readButtons(); 
    navigateMenus();
    rilevTemp();

    if (temperatura > (tRefrig + dRefrig)){
      digitalWrite(refrig,HIGH);
    }
    else {
      digitalWrite(refrig,LOW);
    }
    if (temperatura < (tRisc - dRisc)){
      digitalWrite(risc,HIGH);
    }
    else {
      digitalWrite(risc,LOW);
     
    }   
    if (now.hour() == ACH1h && now.minute() == ACH1m){
      tramonto1 = false;
      alba1 = true;
    }
    if (now.hour() == TCH1h && now.minute() == TCH1m) {
      alba1 = false;
    } 
    if (now.hour() == ACH2h && now.minute() == ACH2m){
      tramonto2 = false;
      alba2 = true;
    }
    if (now.hour() == TCH2h && now.minute() == TCH2m) {
      alba2 = false;
    } 
    if (now.hour() == ACH3h && now.minute() == ACH3m){
      tramonto3 = false;
      alba3 = true;
    }
    if (now.hour() == TCH3h && now.minute() == TCH3m) {
      alba3 = false;
    }   
    if (now.hour() == ACH4h && now.minute() == ACH4m){
      tramonto4 = false;
      alba4 = true;
    }
    if (now.hour() == TCH4h && now.minute() == TCH4m) {
      alba4 = false;
    }   
    if (now.hour() == ACH5h && now.minute() == ACH5m){
      tramonto5 = false;
      alba5 = true;
    }
    if (now.hour() == TCH5h && now.minute() == TCH5m) {
      alba5 = false;
    }   
    if (now.hour() == ACH6h && now.minute() == ACH6m){
      tramonto6 = false;
      alba6 = true;
    }
    if (now.hour() == TCH6h && now.minute() == TCH6m) {
      alba6 = false;
    }   
    if (now.hour() == ACH7h && now.minute() == ACH7m){
      tramonto7 = false;
      alba7 = true;
    }
    if (now.hour() == TCH7h && now.minute() == TCH7m) {
      alba7 = false;
    }   
    if (now.hour() == ACH8h && now.minute() == ACH8m){
      tramonto8 = false;
      alba8 = true;
    }
    if (now.hour() == TCH8h && now.minute() == TCH8m) {
      alba8 = false;
    }
    //                                                                              INIZIO IF  ALBA CANALE1
    if (now.hour() >= ACH1h && now.minute() >= ACH1m && tramonto1 == false ) {
      //fnAlba1();
    x1++;
    analogWrite(LED1, x1);
    if (x1 == 255){
      tramonto1=true;
    }
    stepA11 = stepA11 + stepA1;
    }
    else{
      stepA11 = millis();
    }                                                                          //    FINE IF  ALBA CANALE1
                                                                              //    INIZIO IF TRAMONTO CANALE1
   
    if (now.hour() >= TCH1h && now.minute() >= TCH1m && alba1 == false ) {
    x1--;
    analogWrite(LED1, x1);
    if (x1 == 0){;
      alba1=true;
    }
    stepT11 = stepT11 + stepT1;
    }
    else{
      stepT11 = millis();
    }                                                                            //  FINE IF  TRAMONTO CANALE1
   
   
    //                                                                              INIZIO IF  ALBA CANALE2
    if (now.hour() >= ACH2h && now.minute() >= ACH2m && tramonto2 == false ) {
      //fnAlba1();
    x2++;
    analogWrite(LED2, x2);
    if (x2 == 255){
      tramonto2=true;
    }
    stepA22 = stepA22 + stepA2;
    }
    else{
      stepA22 = millis();
    }                                                                          //    FINE IF  ALBA CANALE2
                                                                              //    INIZIO IF TRAMONTO CANALE2
   
    if (now.hour() >= TCH2h && now.minute() >= TCH2m && alba2 == false ) {
    x2--;
    analogWrite(LED2, x2);
    if (x2 == 0){;
      alba2=true;
    }
    stepT22 = stepT22 + stepT2;
    }
    else{
      stepT22 = millis();
    }                                                                            //  FINE IF  TRAMONTO CANALE2
   
    //                                                                              INIZIO IF  ALBA CANALE3
    if (now.hour() >= ACH3h && now.minute() >= ACH3m && tramonto3 == false ) {
      //fnAlba1();
    x3++;
    analogWrite(LED3, x3);
    if (x3 == 255){
      tramonto3=true;
    }
    stepA33 = stepA33 + stepA3;
    }
    else{
      stepA33 = millis();
    }                                                                          //    FINE IF  ALBA CANALE3
                                                                              //    INIZIO IF TRAMONTO CANALE3
   
    if (now.hour() >= TCH3h && now.minute() >= TCH3m && alba3 == false ) {
    x3--;
    analogWrite(LED3, x3);
    if (x3 == 0){;
      alba3=true;
    }
    stepT33 = stepT33 + stepT3;
    }
    else{
      stepT33 = millis();
    }                                                                            //  FINE IF  TRAMONTO CANALE3
   
    //                                                                              INIZIO IF  ALBA CANALE4
    if (now.hour() >= ACH4h && now.minute() >= ACH4m && tramonto4 == false ) {
      //fnAlba1();
    x4++;
    analogWrite(LED4, x4);
    if (x4 == 255){
      tramonto4=true;
    }
    stepA44 = stepA44 + stepA4;
    }
    else{
      stepA44 = millis();
    }                                                                          //    FINE IF  ALBA CANALE4
                                                                              //    INIZIO IF TRAMONTO CANALE4
   
    if (now.hour() >= TCH4h && now.minute() >= TCH4m && alba4 == false ) {
    x4--;
    analogWrite(LED4, x4);
    if (x4 == 0){;
      alba4=true;
    }
    stepT44 = stepT44 + stepT4;
    }
    else{
      stepT44 = millis();
    }                                                                            //  FINE IF  TRAMONTO CANALE4
   
    //                                                                              INIZIO IF  ALBA CANALE5
    if (now.hour() >= ACH5h && now.minute() >= ACH5m && tramonto5 == false ) {
      //fnAlba1();
    x5++;
    analogWrite(LED5, x5);
    if (x5 == 255){
      tramonto5 = true;
    }
    stepA55 = stepA55 + stepA5;
    }
    else{
      stepA55 = millis();
    }                                                                          //    FINE IF  ALBA CANALE5
                                                                              //    INIZIO IF TRAMONTO CANALE5
   
    if (now.hour() >= TCH5h && now.minute() >= TCH5m && alba5 == false ) {
    x5--;
    analogWrite(LED5, x5);
    if (x5 == 0){;
      alba5=true;
    }
    stepT55 = stepT55 + stepT5;
    }
    else{
      stepT55 = millis();
    }                                                                            //  FINE IF  TRAMONTO CANALE5
   
    //                                                                              INIZIO IF  ALBA CANALE6
    if (now.hour() >= ACH6h && now.minute() >= ACH6m && tramonto6 == false ) {
      //fnAlba1();
    x6++;
    analogWrite(LED6, x6);
    if (x6 == 255){
      tramonto6 = true;
    }
    stepA66 = stepA66 + stepA6;
    }
    else{
      stepA66 = millis();
    }                                                                          //    FINE IF  ALBA CANALE6
                                                                              //    INIZIO IF TRAMONTO CANALE6
   
    if (now.hour() >= TCH6h && now.minute() >= TCH6m && alba6 == false ) {
    x6--;
    analogWrite(LED6, x6);
    if (x6 == 0){;
      alba6 = true;
    }
    stepT66 = stepT66 + stepT6;
    }
    else{
      stepT66 = millis();
    }                                                                            //  FINE IF  TRAMONTO CANALE6
   
    //                                                                              INIZIO IF  ALBA CANALE7
    if (now.hour() >= ACH7h && now.minute() >= ACH7m && tramonto7 == false ) {
      //fnAlba1();
    x7++;
    analogWrite(LED7, x7);
    if (x7 == 255){
      tramonto7=true;
    }
    stepA77 = stepA77 + stepA7;
    }
    else{
      stepA77 = millis();
    }                                                                          //    FINE IF  ALBA CANALE7
                                                                              //    INIZIO IF TRAMONTO CANALE7
   
    if (now.hour() >= TCH7h && now.minute() >= TCH7m && alba7 == false ) {
    x7--;
    analogWrite(LED7, x7);
    if (x7 == 0){;
      alba7=true;
    }
    stepT77 = stepT77 + stepT7;
    }
    else{
      stepT77 = millis();
    }                                                                            //  FINE IF  TRAMONTO CANALE7
   
    //                                                                              INIZIO IF  ALBA CANALE8
    if (now.hour() >= ACH8h && now.minute() >= ACH8m && tramonto8 == false ) {
      //fnAlba1();
    x8++;
    analogWrite(LED8, x8);
    if (x8 == 255){
      tramonto8=true;
    }
    stepA88 = stepA88 + stepA8;
    }
    else{
      stepA88 = millis();
    }                                                                          //    FINE IF  ALBA CANALE8
                                                                              //    INIZIO IF TRAMONTO CANALE8
   
    if (now.hour() >= TCH8h && now.minute() >= TCH8m && alba8 == false ) {
    x8--;
    analogWrite(LED8, x8);
    if (x8 == 0){;
      alba8=true;
    }
    stepT88 = stepT88 + stepT8;
    }
    else{
      stepT88 = millis();
    }                                                                            //  FINE IF  TRAMONTO CANALE8
   
   

  switch (nMenu){



  case 0:
    if ( digitalRead( buttonMeno ) == HIGH || ( digitalRead( buttonPiu )) == HIGH) {
      time = millis();
    }

   
    lcd.clear();

    sprintf(buffer,  "%02d/%02d/%d", now.day(), now.month(), now.year());
    lcd.setCursor(0,0);
    lcd.print( buffer );


    sprintf(buffer,  "%02d:%02d", now.hour(), now.minute());
    lcd.setCursor(11,0);
    lcd.print( buffer );
    lcd.setCursor(0,1);
    lcd.print("Temperatura: ");
    lcd.setCursor(13,1);
    lcd.print(temperatura);
    lcd.setCursor(15,1);
    lcd.print(char(223));
   
    if (time > 0 && setModeTime < (millis() - time) ) {
      setMode( now );
    }


    if ( digitalRead( buttonPinEsc ) == HIGH) {

      lcd.setCursor(0,1);
      //sprintf( buffer);
    }
    else if ( digitalRead( buttonPinEsc ) == LOW) {
      char buffer[10] = "";
      (buffer,  "%02d/%02d/%d", now.day(), now.month(), now.year());
    }


    //delay(1000);
    break;

  case 1:

    // char CH1ora[5]="";

    if (digitalRead(buttonPiu) == HIGH) {
      ACH1h = (ACH1h++);
      delay(200);
    }
    if (digitalRead(buttonMeno) == HIGH) {
      ACH1m = (ACH1m++);
      delay(200);
    }
    if (ACH1h > 23) {
      ACH1h = 0;
    }
    if (ACH1m > 59) {
      ACH1m = 0;
    }
    sprintf(CH1ora,"");
    sprintf(CH1ora,  "%02d:%02d", ACH1h, ACH1m);
    lcd.setCursor(0,1);
    lcd.print( CH1ora ); 


    break;

  case 2:
    if (digitalRead(buttonPiu) == HIGH){
      FACH1=(FACH1++);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FACH1);
    }
    if (digitalRead(buttonMeno) == HIGH && FACH1 >=1){
      FACH1=(FACH1--);
      delay(300);

      lcd.setCursor(0,1);
      lcd.print(FACH1);
    }
    stepA1 = ((FACH1 * 60000)/255);
    break; 

  case 3:

    if (digitalRead(buttonPiu) == HIGH) {
      TCH1h = (TCH1h++);
      delay(200);
    }
    if (digitalRead(buttonMeno) == HIGH) {
      TCH1m = (TCH1m++);
      delay(200);
    }
    if (TCH1h > 23) {
      TCH1h = 0;
    }
    if (TCH1m > 59) {
      TCH1m = 0;
    }
    sprintf(CH1ora,"");
    sprintf(CH1ora,  "%02d:%02d", TCH1h, TCH1m);
    lcd.setCursor(0,1);
    lcd.print( CH1ora );
    break;


  case 4:
    if (digitalRead(buttonPiu) == HIGH){
      FTCH1=(FTCH1++);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FTCH1);
    }
    if (digitalRead(buttonMeno) == HIGH){
      FTCH1=(FTCH1--);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FTCH1);
    }
    stepT2 = ((FTCH1*60000)/255);
    break;


  case 5:

    // char CH1ora[5]="";

    if (digitalRead(buttonPiu) == HIGH) {
      ACH2h = (ACH2h++);
      delay(200);
    }
    if (digitalRead(buttonMeno) == HIGH) {
      ACH2m = (ACH2m++);
      delay(200);
    }
    if (ACH2h > 23) {
      ACH2h = 0;
    }
    if (ACH2m > 59) {
      ACH2m = 0;
    }
    sprintf(CH2ora,"");
    sprintf(CH2ora,  "%02d:%02d", ACH2h, ACH2m);
    lcd.setCursor(0,1);
    lcd.print( CH2ora ); 


    break;

  case 6:
    if (digitalRead(buttonPiu) == HIGH){
      FACH2=(FACH2++);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FACH2);
    }
    if (digitalRead(buttonMeno) == HIGH){
      FACH2=(FACH2--);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FACH2);
    }
    stepA2=((FACH2*60000)/255);
    break;   

  case 7:

    if (digitalRead(buttonPiu) == HIGH) {
      TCH2h = (TCH2h++);
      delay(200);
    }
    if (digitalRead(buttonMeno) == HIGH) {
      TCH2m = (TCH2m++);
      delay(200);
    }
    if (TCH2h > 23) {
      TCH2h = 0;
    }
    if (TCH2m > 59) {
      TCH2m = 0;
    }
    sprintf(CH2ora,"");
    sprintf(CH2ora,  "%02d:%02d", TCH2h, TCH2m);
    lcd.setCursor(0,1);
    lcd.print( CH2ora ); 


    break;

  case 8:
    if (digitalRead(buttonPiu) == HIGH){
      FTCH2=(FTCH2++);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FTCH2);
    }
    if (digitalRead(buttonMeno) == HIGH){
      FTCH2=(FTCH2--);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FTCH2);
    }
    stepT2 = ((FTCH2*60000)/255);
    break; 


  case 9:

    // char CH1ora[5]="";

    if (digitalRead(buttonPiu) == HIGH) {
      ACH3h = (ACH3h++);
      delay(200);
    }
    if (digitalRead(buttonMeno) == HIGH) {
      ACH3m = (ACH3m++);
      delay(200);
    }
    if (ACH3h > 23) {
      ACH3h = 0;
    }
    if (ACH3m > 59) {
      ACH3m = 0;
    }
    sprintf(CH3ora,"");
    sprintf(CH3ora,  "%02d:%02d", ACH3h, ACH3m);
    lcd.setCursor(0,1);
    lcd.print( CH3ora ); 


    break;

  case 10:
    if (digitalRead(buttonPiu) == HIGH){
      FACH3=(FACH3++);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FACH3);
    }
    if (digitalRead(buttonMeno) == HIGH && FACH3 >=1){
      FACH3=(FACH3--);
      delay(300);

      lcd.setCursor(0,1);
      lcd.print(FACH3);
    }
    stepA3 = ((FACH3*60000)/255);
    break; 

  case 11:

    if (digitalRead(buttonPiu) == HIGH) {
      TCH3h = (TCH3h++);
      delay(200);
    }
    if (digitalRead(buttonMeno) == HIGH) {
      TCH3m = (TCH3m++);
      delay(200);
    }
    if (TCH3h > 23) {
      TCH3h = 0;
    }
    if (TCH3m > 59) {
      TCH3m = 0;
    }
    sprintf(CH3ora,"");
    sprintf(CH3ora,  "%02d:%02d", TCH3h, TCH3m);
    lcd.setCursor(0,1);
    lcd.print( CH3ora ); 


    break;


  case 12:
    if (digitalRead(buttonPiu) == HIGH){
      FTCH3=(FTCH3++);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FTCH3);
    }
    if (digitalRead(buttonMeno) == HIGH){
      FTCH3=(FTCH3--);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FTCH3);
    }
    stepT3 = ((FTCH3*60000)/255);
    break;

  case 13:

    // char CH1ora[5]="";

    if (digitalRead(buttonPiu) == HIGH) {
      ACH4h = (ACH4h++);
      delay(200);
    }
    if (digitalRead(buttonMeno) == HIGH) {
      ACH4m = (ACH4m++);
      delay(200);
    }
    if (ACH4h > 23) {
      ACH4h = 0;
    }
    if (ACH4m > 59) {
      ACH4m = 0;
    }
    sprintf(CH4ora,"");
    sprintf(CH4ora,  "%02d:%02d", ACH4h, ACH4m);
    lcd.setCursor(0,1);
    lcd.print( CH4ora ); 


    break;

  case 14:
    if (digitalRead(buttonPiu) == HIGH){
      (FACH4++);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FACH4);
    }
    if (digitalRead(buttonMeno) == HIGH && FACH4 >=1){
      (FACH4--);
      delay(300);

      lcd.setCursor(0,1);
      lcd.print(FACH4);
    }
    stepA4 = ((FACH4*60000)/255);
    break; 

  case 15:

    if (digitalRead(buttonPiu) == HIGH) {
      TCH4h = (TCH4h++);
      delay(200);
    }
    if (digitalRead(buttonMeno) == HIGH) {
      TCH4m = (TCH4m++);
      delay(200);
    }
    if (TCH4h > 23) {
      TCH4m = 0;
    }
    if (TCH4m > 59) {
      TCH4m = 0;
    }
    sprintf(CH4ora,"");
    sprintf(CH4ora,  "%02d:%02d", TCH4h, TCH4m);
    lcd.setCursor(0,1);
    lcd.print( CH4ora );
    break;


  case 16:
    if (digitalRead(buttonPiu) == HIGH){
      (FTCH4++);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FTCH4);
    }
    if (digitalRead(buttonMeno) == HIGH){
      (FTCH4--);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FTCH4);
    }
    stepT4 = ((FTCH4*60000)/255);
    break;


  case 17:
    if (digitalRead(buttonPiu) == HIGH) {
      ACH5h = (ACH5h++);
      delay(200);
    }
    if (digitalRead(buttonMeno) == HIGH) {
      ACH5m = (ACH5m++);
      delay(200);
    }
    if (ACH5h > 23) {
      ACH5h = 0;
    }
    if (ACH5m > 59) {
      ACH5m = 0;
    }
    sprintf(CH5ora,"");
    sprintf(CH5ora,  "%02d:%02d", ACH5h, ACH5m);
    lcd.setCursor(0,1);
    lcd.print( CH5ora ); 


    break;

  case 18:
    if (digitalRead(buttonPiu) == HIGH){
      (FACH5++);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FACH5);
    }
    if (digitalRead(buttonMeno) == HIGH){
      (FACH5--);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FACH5);
    }
    stepA5 = ((FACH5*60000)/255);
    break;   

  case 19:

    if (digitalRead(buttonPiu) == HIGH) {
      TCH5h = (TCH5h++);
      delay(200);
    }
    if (digitalRead(buttonMeno) == HIGH) {
      TCH5m = (TCH5m++);
      delay(200);
    }
    if (TCH5h > 23) {
      TCH5h = 0;
    }
    if (TCH5m > 59) {
      TCH5m = 0;
    }
    sprintf(CH5ora,"");
    sprintf(CH5ora,  "%02d:%02d", TCH5h, TCH5m);
    lcd.setCursor(0,1);
    lcd.print( CH5ora ); 


    break;

  case 20:
    if (digitalRead(buttonPiu) == HIGH){
      (FTCH5++);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FTCH5);
    }
    if (digitalRead(buttonMeno) == HIGH){
      (FTCH5--);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FTCH5);
    }
    stepT5 = ((FTCH5*60000)/255);
    break; 


  case 21:
    if (digitalRead(buttonPiu) == HIGH) {
      (ACH6h++);
      delay(200);
    }
    if (digitalRead(buttonMeno) == HIGH) {
      (ACH6m++);
      delay(200);
    }
    if (ACH6h > 23) {
      ACH6h = 0;
    }
    if (ACH6m > 59) {
      ACH6m = 0;
    }
    sprintf(CH6ora,"");
    sprintf(CH6ora,  "%02d:%02d", ACH6h, ACH6m);
    lcd.setCursor(0,1);
    lcd.print( CH6ora ); 


    break;

  case 22:
    if (digitalRead(buttonPiu) == HIGH){
      (FACH6++);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FACH6);
    }
    if (digitalRead(buttonMeno) == HIGH){
      FACH6=(FACH6--);
      delay(300);

      lcd.setCursor(0,1);
      lcd.print(FACH6);
    }
    stepA6 = ((FACH6*60000)/255);
    break; 

  case 23:

    if (digitalRead(buttonPiu) == HIGH) {
      (TCH6h++);
      delay(200);
    }
    if (digitalRead(buttonMeno) == HIGH) {
      (TCH6m++);
      delay(200);
    }
    if (TCH6h > 23) {
      TCH6h = 0;
    }
    if (TCH6m > 59) {
      TCH6m = 0;
    }
    sprintf(CH6ora,"");
    sprintf(CH6ora,  "%02d:%02d", TCH6h, TCH6m);
    lcd.setCursor(0,1);
    lcd.print( CH6ora ); 


    break;


  case 24:
    if (digitalRead(buttonPiu) == HIGH){
      (FTCH6++);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FTCH6);
    }
    if (digitalRead(buttonMeno) == HIGH){
      (FTCH6--);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FTCH6);
    }
    stepT6 = ((FTCH6*60000)/255);
    break;


  case 25:

    // char CH1ora[5]="";

    if (digitalRead(buttonPiu) == HIGH) {
      (ACH7h++);
      delay(200);
    }
    if (digitalRead(buttonMeno) == HIGH) {
      (ACH7m++);
      delay(200);
    }
    if (ACH7h > 23) {
      ACH7h = 0;
    }
    if (ACH7m > 59) {
      ACH7m = 0;
    }
    sprintf(CH7ora,"");
    sprintf(CH7ora,  "%02d:%02d", ACH7h, ACH7m);
    lcd.setCursor(0,1);
    lcd.print( CH7ora ); 


    break;

  case 26:
    if (digitalRead(buttonPiu) == HIGH){
      (FACH7++);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FACH7);
    }
    if (digitalRead(buttonMeno) == HIGH){
      (FACH7--);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FACH7);
    }
    stepA7 = ((FACH7*60000)/255);
    break;   

  case 27:

    if (digitalRead(buttonPiu) == HIGH) {
      (TCH7h++);
      delay(200);
    }
    if (digitalRead(buttonMeno) == HIGH) {
      (TCH7m++);
      delay(200);
    }
    if (TCH7h > 23) {
      TCH7h = 0;
    }
    if (TCH7m > 59) {
      TCH7m = 0;
    }
    sprintf(CH7ora,"");
    sprintf(CH7ora,  "%02d:%02d", TCH7h, TCH7m);
    lcd.setCursor(0,1);
    lcd.print( CH7ora ); 


    break;

  case 28:
    if (digitalRead(buttonPiu) == HIGH){
      (FTCH7++);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FTCH7);
    }
    if (digitalRead(buttonMeno) == HIGH){
      (FTCH7--);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FTCH7);
    }
    stepT7 = ((FTCH7*60000)/255);
    break;

  case 29:

    // char CH1ora[5]="";

    if (digitalRead(buttonPiu) == HIGH) {
      (ACH8h++);
      delay(200);
    }
    if (digitalRead(buttonMeno) == HIGH) {
      (ACH8m++);
      delay(200);
    }
    if (ACH8h > 23) {
      ACH8h = 0;
    }
    if (ACH8m > 59) {
      ACH8m = 0;
    }
    sprintf(CH8ora,"");
    sprintf(CH8ora,  "%02d:%02d", ACH8h, ACH8m);
    lcd.setCursor(0,1);
    lcd.print( CH8ora ); 


    break;

  case 30:
    if (digitalRead(buttonPiu) == HIGH){
      (FACH8++);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FACH8);
    }
    if (digitalRead(buttonMeno) == HIGH ){
      (FACH8--);
      delay(300);

      lcd.setCursor(0,1);
      lcd.print(FACH8);
    }
    stepA8 = ((FACH8*60000)/255);
    break; 

  case 31:

    if (digitalRead(buttonPiu) == HIGH) {
      (TCH8h++);
      delay(200);
    }
    if (digitalRead(buttonMeno) == HIGH) {
      (TCH8m++);
      delay(200);
    }
    if (TCH8h > 23) {
      TCH8h = 0;
    }
    if (TCH8m > 59) {
      TCH8m = 0;
    }
    sprintf(CH8ora,"");
    sprintf(CH8ora,  "%02d:%02d", TCH8h, TCH8m);
    lcd.setCursor(0,1);
    lcd.print( CH8ora );
    break;


  case 32:
    if (digitalRead(buttonPiu) == HIGH){
      (FTCH8++);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FTCH8);
    }
    if (digitalRead(buttonMeno) == HIGH){
      (FTCH8--);
      delay(300);
      //lcd.clear;
      lcd.setCursor(0,1);
      lcd.print(FTCH8);
    }
    stepT8 = ((FTCH8*60000)/255);
    break;

  case 33:
    if (digitalRead(buttonPiu) == HIGH){
      tRisc=(tRisc+0.1);
      delay(300);
      lcd.setCursor(0,1);
      lcd.print(tRisc);
    }
    if (digitalRead(buttonMeno) == HIGH){
      tRisc=(tRisc-0.1);
      delay(300);
      lcd.setCursor(0,1);
      lcd.print(tRisc);
    }
    break;

  case 34:
    if (digitalRead(buttonPiu) == HIGH){
      dRisc=(dRisc+0.1);
      delay(300);
      lcd.setCursor(0,1);
      lcd.print(dRisc);
    }
    if (digitalRead(buttonMeno) == HIGH){
      dRisc=(dRisc-0.1);
      delay(300);
      lcd.setCursor(0,1);
      lcd.print(dRisc);
    }
    break;

  case 35:
    if (digitalRead(buttonPiu) == HIGH){
      tRefrig=(tRefrig+0.1);
      delay(300);
      lcd.setCursor(0,1);
      lcd.print(tRefrig);
    }
    if (digitalRead(buttonMeno) == HIGH){
      tRefrig=(tRefrig-0.1);
      delay(300);
      lcd.setCursor(0,1);
      lcd.print(tRefrig);
    }
    break;

  case 36:
    if (digitalRead(buttonPiu) == HIGH){
      dRefrig=(dRefrig+0.1);
      delay(300);
      lcd.setCursor(0,1);
      lcd.print(dRefrig);
    }
    if (digitalRead(buttonMeno) == HIGH){
      dRefrig=(dRefrig-0.1);
      delay(300);
      lcd.setCursor(0,1);
      lcd.print(dRefrig);
    }
    break;
   
  case 100:
    if ( digitalRead( buttonMeno ) == HIGH || ( digitalRead( buttonPiu )) == HIGH) {
      time = millis();
    }

    /*
    lcd.clear();

    sprintf(buffer,  "%02d/%02d/%d", now.day(), now.month(), now.year());
    lcd.setCursor(0,0);
    lcd.print( buffer );


    sprintf(buffer,  "%02d:%02d", now.hour(), now.minute());
    lcd.setCursor(11,0);
    lcd.print( buffer );
    lcd.setCursor(0,1);
    lcd.print("Temperatura: ");
    lcd.setCursor(13,1);
    lcd.print(temperatura);
    lcd.setCursor(15,1);
    lcd.print(char(223));
    */
    if (time > 0 && setModeTime < (millis() - time) ) {
      setMode( now );
    }


    if ( digitalRead( buttonPinEsc ) == HIGH) {

      lcd.setCursor(0,1);
      //sprintf( buffer);
    }
    else if ( digitalRead( buttonPinEsc ) == LOW) {
      char buffer[10] = "";
      (buffer,  "%02d/%02d/%d", now.day(), now.month(), now.year());
    }


    delay(1000);
    break;






  }  //  SWITCH
} //loop()...

void setMode( DateTime now ) {
  boolean setMode = true;
  int setModeLevel = 0;

  int _day = now.day();
  int _month = now.month();
  int _year = now.year();
  int _hour = now.hour();
  int _min = now.minute();
  int _sec = now.second();

  lcd.clear();
  lcd.setCursor(0,0);
  sprintf(buffer,  "%s: %02d", "Giorno", _day);
  delay( 1000 );
  timeSet = millis();

  while ( setMode ) {
    if ( digitalRead(buttonPinEnter) == HIGH || digitalRead(buttonPiu) == HIGH || digitalRead(buttonMeno) == HIGH ) {
      timeSet = millis();
    }

    lcd.setCursor(0,0);

    // Set Day
    if ( setModeLevel == 0 ) {
      if ( digitalRead(buttonPiu) == HIGH && _day < 31) {
        _day++;
      }
      if ( digitalRead(buttonMeno) == HIGH && _day > 1) {
        _day--;
      }

      sprintf(buffer,  "%s: %02d", "Giorno", _day);
    }
    // Set Month
    if ( setModeLevel == 1 ) {
      if ( digitalRead(buttonPiu) == HIGH && _month < 12) {
        _month++;
      }
      if ( digitalRead(buttonMeno) == HIGH && _month > 1) {
        _month--;
      }

      sprintf(buffer,  "%s: %02d", "Mese", _month);
    }
    // Set Year
    if ( setModeLevel == 2 ) {
      if ( digitalRead(buttonPiu) == HIGH && _year < 9999) {
        _year++;
      }
      if ( digitalRead(buttonMeno) == HIGH && _year > 1900) {
        _year--;
      }

      sprintf(buffer,  "%s: %02d", "Anno", _year);
    }
    // Set Hour
    if ( setModeLevel == 3 ) {
      if ( digitalRead(buttonPiu) == HIGH && _hour < 24) {
        _hour++;
      }
      if ( digitalRead(buttonMeno) == HIGH && _hour > 1) {
        _hour--;
      }

      sprintf(buffer,  "%s: %02d", "Ora", _hour);
    }
    // Set Minute
    if ( setModeLevel == 4 ) {
      if ( digitalRead(buttonPiu) == HIGH && _min < 60) {
        _min++;
      }
      if ( digitalRead(buttonMeno) == HIGH && _min > 1) {
        _min--;
      }

      sprintf(buffer,  "%s: %02d", "Minuti", _min);
    }
    // Set Second
    if ( setModeLevel == 5 ) {
      if ( digitalRead(buttonPiu) == HIGH && _sec < 60) {
        _sec++;
      }
      if ( digitalRead(buttonMeno) == HIGH && _sec > 0) {
        _sec--;
      }

      sprintf(buffer,  "%s: %02d", "Secondi", _sec);
    }

    lcd.print( buffer );
    if ( digitalRead(buttonPinEnter) == HIGH ) {
      lcd.clear();
      setModeLevel++; 
    }
    if ( setModeLevel > 5 ) {
      nMenu=0;
      setMode = false;
      break;
    }

    if (timeSet > 0 && (setModeTime*2) < (millis() - timeSet) ) {
      RTC.adjust(DateTime(_year, _month, _day, _hour, _min, _sec));
      setMode = false;
    }
    delay(200);
  }
}


void menuChanged(MenuChangeEvent changed){

  MenuItem newMenuItem=changed.to;

  lcd.setCursor(0,1);

  if(newMenuItem.getName()==menu.getRoot()){
    pulischermo();
  }
  else if(newMenuItem.getName()=="Item1"){
    setLCD();
    lcd.print("ILLUMINAZIONE");
    selOpt();
    nMenu=100;
  }
  else if(newMenuItem.getName()=="CH1"){
    setLCD();
    lcd.print("CANALE 1");
    selOpt();
  }
  else if(newMenuItem.getName()=="CH2"){
    setLCD();
    lcd.print("CANALE 2");
    selOpt();
  }
  else if(newMenuItem.getName()=="CH3"){
    setLCD();
    lcd.print("CANALE 3");
    selOpt();
  }
  else if(newMenuItem.getName()=="CH4"){
    setLCD();
    lcd.print("CANALE 4");
    selOpt();
  }
  else if(newMenuItem.getName()=="CH5"){
    setLCD();
    lcd.print("CANALE 5");
    selOpt();
  }
  else if(newMenuItem.getName()=="CH6"){
    setLCD();
    lcd.print("CANALE 6");
    selOpt();
  }
  else if(newMenuItem.getName()=="CH7"){
    setLCD();
    lcd.print("CANALE 7");
    selOpt();
  }
  else if(newMenuItem.getName()=="CH8"){
    setLCD();
    lcd.print("CANALE 8");
    selOpt();
  }
  else if(newMenuItem.getName()=="ACH1"){
    ach();
    nMenu=1;
  }
  else if(newMenuItem.getName()=="FACH1"){
    fach();
    lcd.print(FACH1);
    nMenu=2;
  }
  else if(newMenuItem.getName()=="TCH1"){
    tch();
    nMenu=3;
  }
  else if(newMenuItem.getName()=="FTCH1"){
    ftch();
    lcd.print(FTCH1);
    nMenu=4;
  }
  else if(newMenuItem.getName()=="ACH2"){
    ach();
    nMenu=5;
  }
  else if(newMenuItem.getName()=="FACH2"){
    fach();
    lcd.print(FACH2);
    nMenu=6;
  }
  else if(newMenuItem.getName()=="TCH2"){
    tch();
    nMenu=7;
  }
  else if(newMenuItem.getName()=="FTCH2"){
    ftch();
    lcd.print(FTCH2);
    nMenu=8;
  }
  else if(newMenuItem.getName()=="ACH3"){
    ach();
    nMenu=9;
  }
  else if(newMenuItem.getName()=="FACH3"){
    fach();
    lcd.print(FACH3);
    nMenu=10;
  }
  else if(newMenuItem.getName()=="TCH3"){
    tch();
    nMenu=11;
  }
  else if(newMenuItem.getName()=="FTCH3"){
    ftch();
    lcd.print(FTCH3);
    nMenu=12;
  }
  else if(newMenuItem.getName()=="ACH4"){
    ach();
    nMenu=13;
  }
  else if(newMenuItem.getName()=="FACH4"){
    fach();
    lcd.print(FACH4);
    nMenu=14;
  }
  else if(newMenuItem.getName()=="TCH4"){
    tch();
    nMenu=15;
  }
  else if(newMenuItem.getName()=="FTCH4"){
    ftch();
    lcd.print(FTCH4);
    nMenu=16;
  }
  else if(newMenuItem.getName()=="ACH5"){
    ach();
    nMenu=17;
  }
  else if(newMenuItem.getName()=="FACH5"){
    fach();
    lcd.print(FACH5);
    nMenu=18;
  }
  else if(newMenuItem.getName()=="TCH5"){
    tch();
    nMenu=19;
  }
  else if(newMenuItem.getName()=="FTCH5"){
    ftch();
    lcd.print(FTCH5);
    nMenu=20;
  }
  else if(newMenuItem.getName()=="ACH6"){
    ach();
    nMenu=21;
  }
  else if(newMenuItem.getName()=="FACH6"){
    fach();
    lcd.print(FACH6);
    nMenu=22;
  }
  else if(newMenuItem.getName()=="TCH6"){
    tch();
    nMenu=23;
  }
  else if(newMenuItem.getName()=="FTCH6"){
    ftch();
    lcd.print(FTCH6);
    nMenu=24;
  }
  else if(newMenuItem.getName()=="ACH7"){
    ach();
    nMenu=25;
  }
  else if(newMenuItem.getName()=="FACH7"){
    fach();
    lcd.print(FACH7);
    nMenu=26;
  }
  else if(newMenuItem.getName()=="TCH7"){
    tch();
    nMenu=27;
  }
  else if(newMenuItem.getName()=="FTCH7"){
    ftch();
    lcd.print(FTCH7);
    nMenu=28;
  }
  else if(newMenuItem.getName()=="ACH8"){
    ach();
    nMenu=29;
  }
  else if(newMenuItem.getName()=="FACH8"){
    fach();
    lcd.print(FACH8);
    nMenu=30;
  }
  else if(newMenuItem.getName()=="TCH8"){
    tch();
    nMenu=31;
  }
  else if(newMenuItem.getName()=="FTCH8"){
    ftch();
    lcd.print(FTCH8);
    nMenu=32;
  }
  else if(newMenuItem.getName()=="Item2"){
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("TEMPERATURE");
    selOpt();
  }
  else if(newMenuItem.getName()=="Riscaldatore"){
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("RISCALDATORE");
    selOpt();
  }
  else if(newMenuItem.getName()=="tRisc"){
    lcd.clear();
    lcd.setCursor(0,0);     
    lcd.print("Temp.Riferimento");
    lcd.setCursor(0,1);
    lcd.print(tRisc);     
    nMenu=33;
  }
  else if(newMenuItem.getName()=="dRisc"){
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Delta intervento");
    lcd.setCursor(0,1);
    lcd.print(dRisc);
    nMenu=34;
  }
  else if(newMenuItem.getName()=="Refrigeratore"){
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("REFRIGERATORE");
    selOpt();
  }
  else if(newMenuItem.getName()=="tRefrig"){
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Temp.Riferimento");
    lcd.setCursor(0,1);
    lcd.print(tRefrig);
    nMenu=35;
  }
  else if(newMenuItem.getName()=="dRefrig"){
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Delta intervento");
    lcd.setCursor(0,1);
    lcd.print(dRefrig);
    nMenu=36;
  }
  else if(newMenuItem.getName()=="Item3"){
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("IMPOSTAZIONI");
    selOpt();
  }
  else if(newMenuItem.getName()=="Data/Ora"){
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Data/Ora");
    lcd.setCursor(0,1);
    lcd.print("Imposta");
    nMenu=100;

  }

  /*
  }else if(newMenuItem.getName()=="Ora"){
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Ora");
  lcd.setCursor(0,1);
  lcd.print("Ora");
  }
  */
}

void menuUsed(MenuUseEvent used){
  lcd.setCursor(0,0); 
  lcd.print("Confermato      ");
  //lcd.setCursor(0,1);
  //lcd.print(used.item.getName());
  delay(3000);  //Ritardo prima del ritorno Home
  nMenu=0;
  pulischermo();
  menu.toRoot();  //Ritorno Home
}


void  readButtons(){  //lettura dello stato dei puls
  int reading;
  int buttonEnterState=LOW;       
  int buttonEscState=LOW;         
  int buttonLeftState=LOW;         
  int buttonRightState=LOW;       

  //Enter button

  reading = digitalRead(buttonPinEnter);



  if (reading != lastButtonEnterState) {

    lastEnterDebounceTime = millis();

  }

  if ((millis() - lastEnterDebounceTime) > debounceDelay) {

    buttonEnterState=reading;
    lastEnterDebounceTime=millis();
  }


  lastButtonEnterState = reading;


  //Esc button             

  reading = digitalRead(buttonPinEsc);



  if (reading != lastButtonEscState) {

    lastEscDebounceTime = millis();
  }

  if ((millis() - lastEscDebounceTime) > debounceDelay) {

    buttonEscState = reading;
    lastEscDebounceTime=millis();
  }


  lastButtonEscState = reading;


  //Down button             

  reading = digitalRead(buttonPinRight);


  // If the switch changed, due to noise or pressing:
  if (reading != lastButtonRightState) {
    // resetta il tempo di rimbalzo
    lastRightDebounceTime = millis();
  }

  if ((millis() - lastRightDebounceTime) > debounceDelay) {

    buttonRightState = reading;
    lastRightDebounceTime =millis();
  }

  lastButtonRightState = reading;                 


  //Up button             
  // scrive lo stato dell'ingresso in una variabile
  reading = digitalRead(buttonPinLeft);


  if (reading != lastButtonLeftState) {
    // resetta il tempo di rimbalzo
    lastLeftDebounceTime = millis();
  }

  if ((millis() - lastLeftDebounceTime) > debounceDelay) {

    buttonLeftState = reading;
    lastLeftDebounceTime=millis();
    ;
  }


  lastButtonLeftState = reading; 

  //Registra il puls schiacciato
  if (buttonEnterState==HIGH){
    lastButtonPushed=buttonPinEnter;

  }
  else if(buttonEscState==HIGH){
    lastButtonPushed=buttonPinEsc;

  }
  else if(buttonRightState==HIGH){
    lastButtonPushed=buttonPinRight;

  }
  else if(buttonLeftState==HIGH){
    lastButtonPushed=buttonPinLeft;

  }
  else{
    lastButtonPushed=0;
  }                 
}

void navigateMenus() {
  MenuItem currentMenu=menu.getCurrent();

  switch (lastButtonPushed){
  case buttonPinEnter:
    if(!(currentMenu.moveDown())){ 
      menu.use();
    }
    else{ 
      menu.moveDown();
    }
    break;
  case buttonPinEsc:
    menu.toRoot();  //ritorno home
    break;
  case buttonPinRight:
    menu.moveRight();
    break;     
  case buttonPinLeft:
    menu.moveLeft();
    break;     
  }

  lastButtonPushed=0; //reset della variabile
}

comunque sto lavorando per ridurlo ulteriormente ;-)

#28 stay tunned

Gaetano

EDIT: in allegato la libreria modificata. Basta inserirla nella cartella Programmi>Arduino>Libreries>Cartella_a_scelta
rinominandolo MenuBackend.h e riavviare Arduino

Colaki 13-08-2014 21:39

...cosa dire...leggendo mi trovo in affanno per ....questo sketch. Pensa solo oggi son riuscito a capire come cambiare/inserire l'ora al ds1307.
Tanto di cappello. Sono basito. I mie complimenti. Mi sa ..se lo vorrai...che ti disturberò...
Ancora bravo!!!!!!!!!!

SirNino 14-08-2014 10:11

Quote:

Originariamente inviata da Colaki (Messaggio 1062465276)
...cosa dire...leggendo mi trovo in affanno per ....questo sketch. Pensa solo oggi son riuscito a capire come cambiare/inserire l'ora al ds1307.
Tanto di cappello. Sono basito. I mie complimenti. Mi sa ..se lo vorrai...che ti disturberò...
Ancora bravo!!!!!!!!!!

Nessun problema...ovviamente fin dove arrivo!! #rotfl##rotfl#

Ho disegnato anche l'assemblaggio dei componenti

http://s27.postimg.cc/5irpirenj/arduino_marco_bb.jpg

SirNino 14-08-2014 10:29

Ragazzi scusate ho trovato un errore nel void loop()
Ho corretto la seconda parte di sketch pubblicata nel post precedente.
Per chi avesse già caricato lo sketch nell'ide:
- alla riga 625 correggere

codice:

alba3=true;
in

codice:

alba5=true;
Scusate #12

Colaki 18-08-2014 20:53

Ciao, al rientro a casa ho voluto provare il tuo sketch, copiato ed inserito, alla verifica mi evidenzia la riga 1673
if(newMenuItem.getName()==menu.getRoot()){
con questo errore
no match for 'operator==' in 'newMenuItem.MenuItem::getName()==menu.MenuBackend ::getRoot()'
è errata la mia libreria MenuBackend??
Solo per curiosità

SirNino 19-08-2014 07:29

Cavolo @Colaki grazie per la segnalazione!
mi ero dimenticato di dirvi che bisogna anche modificare la libreria menuBackend.h

aggiungere, alla riga 195 del file MenuBackend.h subito prima della riga con scritto "private:", questo metodo:
codice:

    void toRoot() {
        setCurrent( &getRoot() );
    }

Questo metodo mi serve per poter tornare agevolmente alla radice del menu (all'home).

Colaki 19-08-2014 08:17

Ok questa sera provo e ti faccio sapere!#70

marco3020 19-08-2014 10:05

Ragazzi io sono in vacanza non ho ancora provato uff

SirNino 19-08-2014 10:08

Quote:

Originariamente inviata da marco3020 (Messaggio 1062467644)
Ragazzi io sono in vacanza non ho ancora provato uff

Beato te!!
Poi pensa a quante fatiche ti stai risparmiando... @Colaki ti sta facendo da beta tester!!#rotfl#

SirNino 19-08-2014 19:07

Aggiornato il post 23 aggiungendo l'allegato della libreria modificata.

marco3020 05-09-2014 11:51

eccomi ho provato lo sketch mi da questo errore :(
<a target="_blank" href="http://imageshack.com/f/iqRogOdPp"><img src="http://imagizer.imageshack.us/v2/150x100q90/674/RogOdP.png" border="0"></a>

Colaki 05-09-2014 12:51

Quote:

Originariamente inviata da marco3020 (Messaggio 1062479810)
eccomi ho provato lo sketch mi da questo errore :(
<a target="_blank" href="http://imageshack.com/f/iqRogOdPp"><img src="http://imagizer.imageshack.us/v2/150x100q90/674/RogOdP.png" border="0"></a>

Secondo me hai inserito qualcosa che non ha niente a che vedere con lo Skecth fatto da SirNino :-))

SirNino 05-09-2014 12:55

No credo che abbia solo incollato male lo screenshot dell'errore. @marco3020 non si vede l'inmagine

marco3020 09-09-2014 11:32

Buongiorno a tutti ho riprovato facendo il copia e incolla dal post ma mi da sempre stesso errore :(


http://s30.postimg.cc/rlz72sh9p/copi...SSO_ERRORE.jpg

SirNino 09-09-2014 13:03

Ciao @marco3020 , potresti copia/incollarmi tutto il messaggio di errore che ti da? Mi servono soprattutto le prime righe di quel messaggio.

marco3020 09-09-2014 13:47

ecco:


sketch_sep09a:17: error: variable or field 'setMode' declared void
sketch_sep09a:17: error: 'DateTime' was not declared in this scope
sketch_sep09a:18: error: variable or field 'menuChanged' declared void
sketch_sep09a:18: error: 'MenuChangeEvent' was not declared in this scope
sketch_sep09a:19: error: variable or field 'menuUsed' declared void
sketch_sep09a:19: error: 'MenuUseEvent' was not declared in this scope
sketch_sep09a:21: error: 'RTC_DS1307' does not name a type
sketch_sep09a:222: error: 'MenuBackend' does not name a type
sketch_sep09a:226: error: 'MenuItem' does not name a type
sketch_sep09a:227: error: 'MenuItem' does not name a type
sketch_sep09a:228: error: 'MenuItem' does not name a type
sketch_sep09a:229: error: 'MenuItem' does not name a type
sketch_sep09a:230: error: 'MenuItem' does not name a type
sketch_sep09a:231: error: 'MenuItem' does not name a type
sketch_sep09a:232: error: 'MenuItem' does not name a type
sketch_sep09a:233: error: 'MenuItem' does not name a type
sketch_sep09a:234: error: 'MenuItem' does not name a type
sketch_sep09a:235: error: 'MenuItem' does not name a type
sketch_sep09a:236: error: 'MenuItem' does not name a type
sketch_sep09a:237: error: 'MenuItem' does not name a type
sketch_sep09a:238: error: 'MenuItem' does not name a type
sketch_sep09a:239: error: 'MenuItem' does not name a type
sketch_sep09a:240: error: 'MenuItem' does not name a type
sketch_sep09a:241: error: 'MenuItem' does not name a type
sketch_sep09a:242: error: 'MenuItem' does not name a type
sketch_sep09a:243: error: 'MenuItem' does not name a type
sketch_sep09a:244: error: 'MenuItem' does not name a type
sketch_sep09a:245: error: 'MenuItem' does not name a type
sketch_sep09a:246: error: 'MenuItem' does not name a type
sketch_sep09a:247: error: 'MenuItem' does not name a type
sketch_sep09a:248: error: 'MenuItem' does not name a type
sketch_sep09a:249: error: 'MenuItem' does not name a type
sketch_sep09a:250: error: 'MenuItem' does not name a type
sketch_sep09a:251: error: 'MenuItem' does not name a type
sketch_sep09a:252: error: 'MenuItem' does not name a type
sketch_sep09a:253: error: 'MenuItem' does not name a type
sketch_sep09a:254: error: 'MenuItem' does not name a type
sketch_sep09a:255: error: 'MenuItem' does not name a type
sketch_sep09a:256: error: 'MenuItem' does not name a type
sketch_sep09a:257: error: 'MenuItem' does not name a type
sketch_sep09a:258: error: 'MenuItem' does not name a type
sketch_sep09a:259: error: 'MenuItem' does not name a type
sketch_sep09a:260: error: 'MenuItem' does not name a type
sketch_sep09a:261: error: 'MenuItem' does not name a type
sketch_sep09a:262: error: 'MenuItem' does not name a type
sketch_sep09a:263: error: 'MenuItem' does not name a type
sketch_sep09a:264: error: 'MenuItem' does not name a type
sketch_sep09a:265: error: 'MenuItem' does not name a type
sketch_sep09a:266: error: 'MenuItem' does not name a type
sketch_sep09a:270: error: 'MenuItem' does not name a type
sketch_sep09a:271: error: 'MenuItem' does not name a type
sketch_sep09a:272: error: 'MenuItem' does not name a type
sketch_sep09a:273: error: 'MenuItem' does not name a type
sketch_sep09a:274: error: 'MenuItem' does not name a type
sketch_sep09a:275: error: 'MenuItem' does not name a type
sketch_sep09a:276: error: 'MenuItem' does not name a type
sketch_sep09a:279: error: 'MenuItem' does not name a type
sketch_sep09a:280: error: 'MenuItem' does not name a type
sketch_sep09a.ino: In function 'void setup()':
sketch_sep09a:319: error: 'RTC' was not declared in this scope
sketch_sep09a:324: error: 'DateTime' was not declared in this scope
sketch_sep09a:328: error: 'menu' was not declared in this scope
sketch_sep09a:328: error: 'menu1Item1' was not declared in this scope
sketch_sep09a:328: error: 'menu1Item2' was not declared in this scope
sketch_sep09a:328: error: 'menu1Item3' was not declared in this scope
sketch_sep09a:329: error: 'menuCanale1' was not declared in this scope
sketch_sep09a:329: error: 'menuCanale2' was not declared in this scope
sketch_sep09a:329: error: 'menuCanale3' was not declared in this scope
sketch_sep09a:329: error: 'menuCanale4' was not declared in this scope
sketch_sep09a:329: error: 'menuCanale5' was not declared in this scope
sketch_sep09a:329: error: 'menuCanale6' was not declared in this scope
sketch_sep09a:329: error: 'menuCanale7' was not declared in this scope
sketch_sep09a:329: error: 'menuCanale8' was not declared in this scope
sketch_sep09a:330: error: 'menuCanale1ACH1' was not declared in this scope
sketch_sep09a:330: error: 'menuCanale1FACH1' was not declared in this scope
sketch_sep09a:330: error: 'menuCanale1TCH1' was not declared in this scope
sketch_sep09a:330: error: 'menuCanale1FTCH1' was not declared in this scope
sketch_sep09a:331: error: 'menuCanale2ACH1' was not declared in this scope
sketch_sep09a:331: error: 'menuCanale2FACH1' was not declared in this scope
sketch_sep09a:331: error: 'menuCanale2TCH1' was not declared in this scope
sketch_sep09a:331: error: 'menuCanale2FTCH1' was not declared in this scope
sketch_sep09a:332: error: 'menuCanale3ACH1' was not declared in this scope
sketch_sep09a:332: error: 'menuCanale3FACH1' was not declared in this scope
sketch_sep09a:332: error: 'menuCanale3TCH1' was not declared in this scope
sketch_sep09a:332: error: 'menuCanale3FTCH1' was not declared in this scope
sketch_sep09a:333: error: 'menuCanale4ACH1' was not declared in this scope
sketch_sep09a:333: error: 'menuCanale4FACH1' was not declared in this scope
sketch_sep09a:333: error: 'menuCanale4TCH1' was not declared in this scope
sketch_sep09a:333: error: 'menuCanale4FTCH1' was not declared in this scope
sketch_sep09a:334: error: 'menuCanale5ACH1' was not declared in this scope
sketch_sep09a:334: error: 'menuCanale5FACH1' was not declared in this scope
sketch_sep09a:334: error: 'menuCanale5TCH1' was not declared in this scope
sketch_sep09a:334: error: 'menuCanale5FTCH1' was not declared in this scope
sketch_sep09a:335: error: 'menuCanale6ACH1' was not declared in this scope
sketch_sep09a:335: error: 'menuCanale6FACH1' was not declared in this scope
sketch_sep09a:335: error: 'menuCanale6TCH1' was not declared in this scope
sketch_sep09a:335: error: 'menuCanale6FTCH1' was not declared in this scope
sketch_sep09a:336: error: 'menuCanale7ACH1' was not declared in this scope
sketch_sep09a:336: error: 'menuCanale7FACH1' was not declared in this scope
sketch_sep09a:336: error: 'menuCanale7TCH1' was not declared in this scope
sketch_sep09a:336: error: 'menuCanale7FTCH1' was not declared in this scope
sketch_sep09a:337: error: 'menuCanale8ACH1' was not declared in this scope
sketch_sep09a:337: error: 'menuCanale8FACH1' was not declared in this scope
sketch_sep09a:337: error: 'menuCanale8TCH1' was not declared in this scope
sketch_sep09a:337: error: 'menuCanale8FTCH1' was not declared in this scope
sketch_sep09a:338: error: 'menuRiscaldatore' was not declared in this scope
sketch_sep09a:338: error: 'menuRefrigeratore' was not declared in this scope
sketch_sep09a:339: error: 'menuTempRisc' was not declared in this scope
sketch_sep09a:339: error: 'menuDeltaRisc' was not declared in this scope
sketch_sep09a:340: error: 'menuTempRefrig' was not declared in this scope
sketch_sep09a:340: error: 'menuDeltaRefrig' was not declared in this scope
sketch_sep09a:341: error: 'menuData' was not declared in this scope
sketch_sep09a.ino: In function 'void pulischermo()':
sketch_sep09a:361: error: 'DateTime' was not declared in this scope
sketch_sep09a:361: error: expected `;' before 'now'
sketch_sep09a:362: error: 'now' was not declared in this scope
sketch_sep09a.ino: In function 'void loop()':
sketch_sep09a:421: error: 'DateTime' was not declared in this scope
sketch_sep09a:421: error: expected `;' before 'now'
sketch_sep09a:439: error: 'now' was not declared in this scope
sketch_sep09a:443: error: 'now' was not declared in this scope
sketch_sep09a:446: error: 'now' was not declared in this scope
sketch_sep09a:450: error: 'now' was not declared in this scope
sketch_sep09a:453: error: 'now' was not declared in this scope
sketch_sep09a:457: error: 'now' was not declared in this scope
sketch_sep09a:460: error: 'now' was not declared in this scope
sketch_sep09a:464: error: 'now' was not declared in this scope
sketch_sep09a:467: error: 'now' was not declared in this scope
sketch_sep09a:471: error: 'now' was not declared in this scope
sketch_sep09a:474: error: 'now' was not declared in this scope
sketch_sep09a:478: error: 'now' was not declared in this scope
sketch_sep09a:481: error: 'now' was not declared in this scope
sketch_sep09a:485: error: 'now' was not declared in this scope
sketch_sep09a:488: error: 'now' was not declared in this scope
sketch_sep09a:492: error: 'now' was not declared in this scope
sketch_sep09a:496: error: 'now' was not declared in this scope
sketch_sep09a:510: error: 'now' was not declared in this scope
sketch_sep09a:524: error: 'now' was not declared in this scope
sketch_sep09a:538: error: 'now' was not declared in this scope
sketch_sep09a:551: error: 'now' was not declared in this scope
sketch_sep09a:565: error: 'now' was not declared in this scope
sketch_sep09a:578: error: 'now' was not declared in this scope
sketch_sep09a:592: error: 'now' was not declared in this scope
sketch_sep09a:605: error: 'now' was not declared in this scope
sketch_sep09a:619: error: 'now' was not declared in this scope
sketch_sep09a:632: error: 'now' was not declared in this scope
sketch_sep09a:646: error: 'now' was not declared in this scope
sketch_sep09a:659: error: 'now' was not declared in this scope
sketch_sep09a:673: error: 'now' was not declared in this scope
sketch_sep09a:686: error: 'now' was not declared in this scope
sketch_sep09a:700: error: 'now' was not declared in this scope
sketch_sep09a:726: error: 'now' was not declared in this scope
sketch_sep09a:742: error: 'setMode' was not declared in this scope
sketch_sep09a:1530: error: 'setMode' was not declared in this scope
sketch_sep09a.ino: At global scope:
sketch_sep09a:1556: error: variable or field 'setMode' declared void
sketch_sep09a:1556: error: 'DateTime' was not declared in this scope

SirNino 09-09-2014 13:53

allora la maggior parte degli errori mi sembrano legati alla libreria menuBachend. Hai modificato il file o hai caricato quello allegato al post?

marco3020 09-09-2014 14:00

il file menubackend l'ho messo in programmi/ arduino/ libraries/ liquid cristal,
e poi ho fatto copia e incolla del tuo sketch., ( per il sensore di temperatura per la plafo quale consigli)


Tutti gli orari sono GMT +2. Attualmente sono le 11:42.

Powered by vBulletin versione 3.8.9
Copyright ©: 2000 - 2024, Jelsoft Enterprises Ltd.
Traduzione italiana Team: AcquaPortal
User Alert System provided by Advanced User Tagging v3.2.5 Patch Level 2 (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Copyright Zero Pixel Srl

Page generated in 0,17901 seconds with 14 queries