bonjour,
voila tout marche correctement
merci a tout se qui mon aider depuis le début.
voici mon code pour tout les germanophile
#include "LiquidCrystal.h"
#include "WProgram.h"
#include "Wire.h"
#include "DS1307.h"
/*
sorti /entre Arduino
Analog Pin 0 = Température Sensor
Analog Pin 4 = SDA pour ds1307
Analog Pin 5 = SCL pour ds1307
Digital Pin 2 = LCD
Digital Pin 3 = LCD
Digital Pin 4 = LCD
Digital Pin 5 = LCD
Digital Pin 6 = power led
Digital Pin 7 = ventilateur
Digital pin 9 = rouge
Digital pin 10 = blanc
Digital Pin 11 = LCD
Digital Pin 12 = LCD
Digital Pin 8 = bleu uv
*/
//Configuration des Pin de cablage**********************
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int sensorPin = 0;
int power_led = 6;
int bleu_uv = 8;
int rouge = 10;
int blanc = 9;
int ventilateur = 7;
int time;
float temp;
int timerPWM = 0;
int valeurPWM=0;
float PWMStep = 0;
//Configuration des heures allumage/extinction ( format HHMM )**********************
int bleu_uv_on_time = 2030;
int bleu_uv_off_time = 2359;
int ventilateur_on_temp = 26.75;
int ventilateur_off_temp = 26.00;
int minut;
int heure;
int temps_perso;
//Configuration de l'heure ( pour modifier l'heure de votre Arduino, enlevez les /* et */ puis une foi le programe envoyé, remettez les )**********************
void setup() {
/*
RTC.stop();
RTC.set(DS1307_SEC,30); //réglage secondes
RTC.set(DS1307_MIN,52); //réglage minutes
RTC.set(DS1307_HR,11); //réglage heures
RTC.set(DS1307_DOW,6); //réglage jour de la semaine
RTC.set(DS1307_DATE,15); //réglage date
RTC.set(DS1307_MTH,9); //réglage mois
RTC.set(DS1307_YR,12); //réglage année
RTC.start();
*/
//Configuration des entrées/sorties**********************
pinMode(ventilateur, OUTPUT); // digital pin ventilateur 1
pinMode(bleu_uv, OUTPUT); // digital pin pour bleu uv
pinMode(blanc, OUTPUT); // digital pin pour blanc
pinMode(rouge, OUTPUT); // digital pin pour rouge
pinMode(power_led, OUTPUT); // digital pin pour power led
lcd.begin(16,2);
Serial.begin(9600);
}
void loop(){
//Récupération de la température du LM35 ***************************************************************************************
int reading = analogRead(sensorPin);
float voltage = reading * 5.52 / 1024;
int temp = voltage * 100 ;
//Récupération de l'heure du DS1307**********************************************************************************************
heure = RTC.get(DS1307_HR,true);
minut = RTC.get(DS1307_MIN,false);
temps_perso = (heure * 100) + minut;
lcd.clear();
lcd.setCursor(0,0);
lcd.print (" AQUA GESTION ");
lcd.setCursor(6,1);
if (heure < 10)
{
lcd.print("0");
}
lcd.print(heure);
lcd.print("H");
if (minut < 10)
{
lcd.print("0");
}
lcd.print(minut);
lcd.print(" ");
delay(5000);
lcd.setCursor(0,1);
lcd.print(" ");
lcd.print(temp);
lcd.print((char)223);
lcd.print(" ");
delay(5000);
lcd.setCursor(0,0);
lcd.print (" GESTION ");
lcd.setCursor(0,1);
lcd.print (" lune ");
delay(1500);
lcd.setCursor(0,1);
lcd.print (" soleil ");
delay(1500);
lcd.setCursor(0,1);
lcd.print (" temperature ");
delay(1500);
lcd.setCursor(0,1);
lcd.print (" niveau d'eau ");
delay(1500);
lcd.clear();
//Affichage heure******************************************************************************************
lcd.setCursor(0,0);
if (heure < 10)
{
lcd.print("0");
}
lcd.print(heure);
lcd.print("H");
if (minut < 10)
{
lcd.print("0");
}
lcd.print(minut);
lcd.print(" ");
delay (100);
//Affichage température*****************************************************************************
lcd.setCursor(13,0);
lcd.print(temp);
lcd.print((char)223);
//****************ventilateur
if(temp > ventilateur_on_temp){
digitalWrite(ventilateur, HIGH);
}
if(temp < ventilateur_off_temp){
digitalWrite(ventilateur, LOW);
}
//*****Controle des sorties eclairage *********
//**on-off******* bleu uv *************
if(bleu_uv_on_time > temps_perso || bleu_uv_off_time <= temps_perso){
digitalWrite(bleu_uv, LOW);
}
else{
digitalWrite(bleu_uv, HIGH);
}
//***on-off***** rouge ***
if (heure == 8) {
PWMStep = 255 / 59;
timerPWM = minut-60;
valeurPWM = (int)(timerPWM * PWMStep);
analogWrite (rouge, valeurPWM);
lcd.setCursor(0,1);
lcd.print(" + + ROUGE + + ");
delay(5000);
}
else if ((heure == 20) && (minut >30)) {
PWMStep = 255 / 29;
timerPWM = 30-minut;
valeurPWM = (int)(timerPWM * PWMStep);
analogWrite (rouge, valeurPWM);
lcd.setCursor(0,1);
lcd.print(" - - ROUGE - - ");
delay(5000);
}
else if ((heure >= 9 ) && (heure < 21)) {
analogWrite(rouge, 255);
lcd.setCursor(0,1);
lcd.print(" ROUGE on ");
delay(5000);
}
else if ((heure <= 21) && (heure > 8 )){
analogWrite(rouge, 0);
}
//***on-off***** blanc ***
if ((heure == 8) && (minut >30)) {
PWMStep = 255 / 29;
timerPWM = minut-30;
valeurPWM = (int)(timerPWM * PWMStep);
analogWrite (blanc, valeurPWM);
lcd.setCursor(0,1);
lcd.print(" + + BLANC + + ");
delay(5000);
}
else if (heure == 20) {
PWMStep = 255 / 60;
timerPWM = 60-minut;
valeurPWM = (int)(timerPWM * PWMStep);
analogWrite (blanc, valeurPWM);
lcd.setCursor(0,1);
lcd.print(" - - BLANC - - ");
delay(5000);
}
else if ((heure >= 9 ) && (heure < 21)) {
analogWrite(blanc, 255);
lcd.setCursor(0,1);
lcd.print(" BLANC on ");
delay(5000);
}
else if ((heure <= 21) && (heure > 8 )){
analogWrite(blanc, 0);
}
//***on-off***** power led ***
if ((heure == 9) && (minut >3)) {
PWMStep = 240 / 59;
timerPWM = minut-60;
valeurPWM = (int)(timerPWM * PWMStep)+ 15;
analogWrite (power_led, valeurPWM);
lcd.setCursor(0,1);
lcd.print(" + POWER led + ");
delay(5000);
}
else if (heure == 20) { // entre 20:00 et 20:59:59
PWMStep = 240 / 60;
timerPWM = 60-minut;
valeurPWM = (int)(timerPWM * PWMStep) + 15;
analogWrite (power_led, valeurPWM);
lcd.setCursor(0,1);
lcd.print(" - POWER led - ");
delay(5000);
}
else if ((heure >= 10 ) && (heure < 21)) {
analogWrite(power_led, 255);
lcd.setCursor(0,1);
lcd.print(" POWER led on ");
delay(5000);
}
else if ((heure <= 21) && (heure > 9 )){
analogWrite(power_led, 0);
}
//****Affichage ventilateur ********
lcd.setCursor(0,1);
if(digitalRead(ventilateur) == HIGH)
{
lcd.println("ventilateur ON ");
delay(5000);
}
else
{
lcd.println("ventilateur OFF ");
delay(5000);
}
}