Bonjour à tous
A partir d'un ecran tactile arLCD, j'aimerais pouvoir actualisé la température capté par un capteur de température LM35.
Cepandant mon programme ne me permet d'afficher que la première température capter et actualise toutee ma page si j'essaie de le modifier.
#include <ezLCDLib.h>
#include <Wire.h>
#include <math.h>
ezLCD3 lcd;
int xPos = 190;
int y1Pos = 30;
int y2Pos = 95;
int x1Pos = 110;
int y3Pos = 190;
int width = 100;
int height = 40;
int radius = 10;
int alignment = 0;
int option = 1;
int touch=0;
int xPos1 = 90;
int yPos2 = 100;
int yPos1 = 35;
int width1 = 60;
int height1 = 30;
int option1 = 14;
int digits = 3;
int dp = 0;
int x2Pos = 30;
int y4Pos = 190;
int xpo = 10;
int ypo = 65;
int width2 = 45;
int height2 = 90;
int resolution = 1;
int max = 23;
int initial = 0;
int option2 = 3;
int xpo1 = 265;
int max1 = 59;
int x3Pos = 115;
int y5Pos = 50;
int y6Pos = 100;
int xPos6 = 70;
int yPos6 = 70;
int width3 = 80;
int height3 = 80;
int digits1 = 3;
int dp1 = 0;
int xPos7 = 170;
int tempPin = 0;
int tempPin2 = 1;
int dat;
int dat2;
int val;
int val2;
int val3;
void setup()
{ val = analogRead(tempPin);
dat= (500 * val) / 1024;
Wire.begin();
accueil();
}
void loop(){
val = analogRead(tempPin);
dat= (500 * val) / 1024;
touch=lcd.wstack(0);
if (touch==1) temp();
if (touch==2) eclairage();
if (touch==3) heure();
if (touch==6) accueil();
if (touch==1) R();
if (touch==2) R();
if (touch==3) R();
if (touch==1) V();
if (touch==2) V();
if (touch==9) midi();
if (touch==10) soir();
if (touch==11) heure();
if (touch==9) Slide();
if (touch==10) Slide();
}
void accueil(void) {
lcd.begin( EZM_BAUD_RATE );
lcd.cls( WHITE, BLACK );
lcd.font("0");
lcd.printString("\\[5x\\[5yConsigne de temperature :");
lcd.fontw( 1, "sans24" ); // police d'écriture
lcd.theme( 1, 0, 3, 0, 2, 3, 2, 2, 2, 1, 1 );
lcd.string( 1, "Modifier" ); // créé un bouton
lcd.button( 1, xPos, y1Pos, width, height, option, alignment, radius, 1, 1 );
lcd.printString("\\[5x\\[70yConsigne d'eclairage :");
lcd.theme( 2, 0, 3, 0, 2, 3, 2, 2, 2, 1, 1 );
lcd.string( 2, "Modifier" );
lcd.button( 2, xPos, y2Pos, width, height, option, alignment, radius, 2, 2 );
lcd.printString("\\[100x\\[160yReglage horaire");
lcd.theme( 3, 0, 3, 0, 2, 3, 2, 2, 2, 1, 1 );
lcd.string( 3, "Regler" );
lcd.button( 3, x1Pos, y3Pos, width, height, option, alignment, radius, 3, 3 );
lcd.printString("\\[5x\\[40yActuelle :");
lcd.printString("\\[5x\\[105yActuelle :");
lcd.digitalMeter( 4, xPos1, yPos1, width1, height1, option1, dat, digits, dp, 4);
lcd.theme( 4, 155, 152, 3, 130, 0, 0, 1, 147, 153, 1 );
lcd.digitalMeter( 5, xPos1, yPos2, width1, height1, option1, 0, digits, dp, 5);
lcd.theme( 5, 155, 152, 3, 130, 0, 0, 1, 147, 153, 1 );
lcd.wvalue(4, dat);
lcd.wvalue(5, val3);
return valeur();
}
Si quelqu'un peut m'aider à résoudre mon problème, je lui serait reconnaissant.