Bonsoir,
à près avoir posé plein de question, et avoir eu des réponses
je partage mon projet, si ça peut donner des idées à quelqu un
le matos :
un ulcd32pt
une 2560
un protoshield avec un ds32hz et ds1307
des db18b20
du câble reseau
une carte relais kmtronic
et mon code quasi fini :
#include "proxySerial.h"
#include "Serial_LCD.h"
#include <Wire.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <DS1307new.h>// test release
#if SERIAL_LCD_RELEASE < 118
#error required SERIAL_LCD_RELEASE 118
#endifProxySerial myPort(&Serial3);
Serial_LCD myLCD( &myPort);
uint8_t aa;
uint16_t startAddr = 0x0000; // Start address to store in the NV-RAM
uint16_t lastAddr; // new address for storing in NV-RAM
uint16_t TimeIsSet = 0xaa55;//Définition pin de sortie
/*
Digital 5 = relais 1 = Cuisine
Digital 6 = relais 2 = Tom
Digital 4 = relais 3 = Bureau
Digital 3 = relais 4 = Chambre
Digital 2 = relais 5 = SAM
Digital 7 = relais 6 = SAM1
Digital 8 = relais 7 = Entree
Digital 9 = relais 8 = --
*/int PinCuisine = 5;
int PinTom = 6;
int PinBureau = 4;
int PinChambre = 3;
int PinSalle = 2;
int PinSalle1 = 7;
int PinEntree = 8;// Définition pin entrée digital Dallas
#define ONE_WIRE_BUS 36// Définition communication avec tout matériel Onewire
OneWire oneWire(ONE_WIRE_BUS);// Référence t° Dallas
DallasTemperature sensors(&oneWire);
// uint8_t T1[8] = { 0x, 0x, 0x, 0x, 0x, 0x, 0x, 0x }; // Sonde Cuisine
uint8_t T2[8] = { 0x28, 0x4, 0x49, 0xBB, 0x3, 0x0, 0x0, 0x39 }; // Sonde Tom
uint8_t T3[8] = { 0x28, 0x62, 0xEE, 0x74, 0x3, 0x0, 0x0, 0x89 }; // Sonde Bureau
uint8_t T4[8] = { 0x28, 0xDE, 0x2, 0x75, 0x3, 0x0, 0x0, 0x87 }; // Sonde Chambre
uint8_t T5[8] = { 0x28, 0x89, 0x23, 0x63, 0x3, 0x0, 0x0, 0x28 }; // Sonde SAM
// uint8_t T6[8] = { 0x, 0x, 0x, 0x, 0x, 0x, 0x, 0x }; // Entree
// uint8_t T8[8] = { 0x, 0x, 0x, 0x, 0x, 0x, 0x, 0x }; // Sonde Arduino// capteur t°
float sensorCuisine;
float sensorTom;
float sensorBureau;
float sensorChambre;
float sensorSalle;
float sensorEntree;
float sensorArduino;
float sensordefault=-127.00;// Nuit_Jour Temp et delta
float Temp1Nuit=18.00; // cuisine
float Temp1Jour=20.00;
float Temp2Nuit=18.00; // Tom
float Temp2Jour=20.00;
float Temp3Nuit=18.00; // Bureau
float Temp3Jour=20.00;
float Temp4Nuit=18.00; // Chambre
float Temp4Jour=20.00;
float Temp5Nuit=18.00; // SAM
float Temp5Jour=20.00;
float Temp6Nuit=18.00; // Entrée
float Temp6Jour=20.00;
float DeltaJ=0.5;
float DeltaN=1.0;// Divers
//String s;
int Menu=1;
int MAJH;
int ligne;
int valid;
long TBas;
long THaut;
char buffer[8];//balise
int MClear=0;
int CuisineAnnule=0;
int TomAnnule=0;
int BureauAnnule=0;
int ChambreAnnule=0;
int SAMAnnule=0;
int EntreeAnnule=0;
int Annule=0;
int RouteCuisine=0;
int RouteTom=0;
int RouteBureau=0;
int RouteChambre=0;
int RouteSAM=0;
int RouteEntree=0;
int TCuisine=0;
int TTom=0;
int TBureau=0;
int TChambre=0;
int TSAM=0;
int TEntree=0;// Gestion heure
int heure;
int minutes;
int secondes;
long current;
char* jour;
int date=10;
int mois;
int annee;// basculement heure/nuit
long heureN=72000L; // 20h
long heureJ=19800L; //5 h30// remise en route des radiateurs après arrêt
long currentCuisine;
long currentTom;
long currentBureau;
long currentChambre;
long currentSAM;
long currentEntree;
long Remiseenroute=30L;uint8_t c;
void setup() {
Serial.begin(19200);
Serial.print("\n\n\n***\n");
Serial.print("avr\n");
Serial3.begin(9600);myLCD.begin();
delay(100);
myLCD.initSD();delay(100);
// myLCD.checkSD();delay(100);
myLCD.setFontSolid(1);
delay(100);Serial.print("\n setTouch \t");
aa=myLCD.setTouch(true);
Serial.print(aa, DEC);
Serial.print("\n ");pinMode(PinCuisine, OUTPUT);
pinMode(PinTom, OUTPUT);
pinMode(PinBureau, OUTPUT);
pinMode(PinChambre, OUTPUT);
pinMode(PinSalle, OUTPUT);
pinMode(PinSalle1, OUTPUT);
pinMode(PinEntree, OUTPUT);RTC.setRAM(0, (uint8_t *)&startAddr, sizeof(uint16_t));
RTC.getTime();
RTC.ctrl = 0x00; // 0x00=disable SQW pin, 0x10=1Hz,
RTC.setCTRL();
myLCD.setFont(02);
delay(100);}
uint16_t x, y;
uint8_t b;void loop() {
myLCD.setFont(02);
delay(50);c=myLCD.getTouchActivity();
//affichage menu
myLCD.readScreenFAT("Menu.gci", 0, 0);// envoie de commande de récupération
RTC.getTime();
sensors.requestTemperatures();// Récuperation/Affichage Heure
date=RTC.day;
mois=RTC.month;
annee=RTC.year;
heure = RTC.hour;
minutes = RTC.minute;
secondes = RTC.second;//calcul temps en seconde
current=(((long)RTC.hour3600L)+((long)RTC.minute60L)+(long)RTC.second);//affichage jour
switch (RTC.dow)
{
case 1:
jour=("Lundi ");
break;
case 2:
jour=("Mardi ");
break;
case 3:
jour=("Mercredi");
break;
case 4:
jour=("Jeudi ");
break;
case 5:
jour=("Vendredi");
break;
case 6:
jour=("Samedi ");
break;
case 0:
jour=("Dimanche");
break;
}// affichage date/heure
myLCD.gText(55, 15, Serial_LCD::rgb16(254, 254, 1), jour);if (RTC.day < 10)
{
myLCD.gText(126, 15, Serial_LCD::rgb16(254, 254, 1), "0");
myLCD.gText(134, 15, Serial_LCD::rgb16(254, 254, 1), (date));
}
else
{
myLCD.gText(126, 15, Serial_LCD::rgb16(254, 254, 1), (date));
}myLCD.gText(143, 15, Serial_LCD::rgb16(254, 254, 1), "/");
if (RTC.month < 10)
{
myLCD.gText(152, 15, Serial_LCD::rgb16(254, 254, 1), "0");
myLCD.gText(160, 15, Serial_LCD::rgb16(254, 254, 1), (mois));
}
else
{
myLCD.gText(152, 15, Serial_LCD::rgb16(254, 254, 1), (mois));
}myLCD.gText(169, 15, Serial_LCD::rgb16(254, 254, 1), "/");
myLCD.gText(178, 15, Serial_LCD::rgb16(254, 254, 1), (annee));
if (RTC.hour < 10)
{
myLCD.gText(247, 15, Serial_LCD::rgb16(254, 254, 1), "0");
myLCD.gText(255, 15, Serial_LCD::rgb16(254, 254, 1), (heure));
}
else
{
myLCD.gText(247, 15, Serial_LCD::rgb16(254, 254, 1), (heure));
}myLCD.gText(262, 15, Serial_LCD::rgb16(254, 254, 1), ":");
if (RTC.minute < 10)
{
myLCD.gText(271, 15, Serial_LCD::rgb16(254, 254, 1), "0");
myLCD.gText(279, 15, Serial_LCD::rgb16(254, 254, 1), (minutes));
}
else
{
myLCD.gText(271, 15, Serial_LCD::rgb16(254, 254, 1), (minutes));
}myLCD.gText(286, 15, Serial_LCD::rgb16(254, 254, 1), ":");
if (RTC.second < 10)
{
myLCD.gText(295, 15, Serial_LCD::rgb16(254, 254, 1), "0");
myLCD.gText(303, 15, Serial_LCD::rgb16(254, 254, 1), (secondes));
}
else
{
myLCD.gText(295, 15, Serial_LCD::rgb16(254, 254, 1), (secondes));
}// Gestion/Récuperation/Affichage Temp
//sensorCuisine = sensors.getTempC(T1);
sensorTom = sensors.getTempC(T2);
sensorBureau = sensors.getTempC(T3);
sensorChambre = sensors.getTempC(T4);
sensorSalle = sensors.getTempC(T5);
//sensorEntree = sensors.getTempC(T6);
//sensorArduino = sensors.getTempC(T8);
il sera mis a jour quand j aurai fini, les possibilités de mise a jour à travers l écran
je rappelle que je suis débutant, donc il n est pas forcément optimisé mais fonctionnel