bsr ts le monde ,j'ai un mini projet sur thermomètre on utilise arduino et proteus le problème que LCD affiche des grands valeurs et si je change la valeur de LM35 la valeur dans LCD reste même
Code:#include<LiquidCrystal.h> #include <TimerOne.h> LiquidCrystal lcd(7,6,5,4,3,2); int R_LED = 11; int Y_LED = 9; int G_LED = 10; void setup() { lcd.begin(16,2); // Set the pin modes of the above IO pins to OUTPUT pinMode(R_LED, OUTPUT); pinMode(Y_LED, OUTPUT); pinMode(G_LED, OUTPUT); lcd.setCursor(2, 0); // Print a message to the LCD. lcd.print(" Hello!"); lcd.setCursor(0,1); lcd.print(" this a Thermometer"); delay(1000); lcd.clear(); lcd.setCursor(0,0); lcd.print(" projet "); lcd.setCursor(0,1); lcd.print(" Thermometer "); delay(1000); lcd.clear(); } void loop() { float vol = (analogRead(A0) * (5.0/1024.0)*100); //a)nalog read the temperature sensor voltage delay(10); // Result Display in lcd lcd.clear(); lcd.setCursor(2,0); lcd.print("Temperature"); lcd.setCursor(4,1); lcd.print(vol); lcd.print("C"); delay(1000); if (vol<=31) //if the temperature is low { digitalWrite(G_LED, HIGH); // GREEN led on digitalWrite(Y_LED, LOW); digitalWrite(R_LED, LOW); } else if (vol>=32 && vol<=40) // if the temperature is middle { digitalWrite(R_LED, LOW); digitalWrite(Y_LED, HIGH); //YELLOW led on digitalWrite(G_LED, LOW); } else if (vol>=41) //If the temperature is HIGH { digitalWrite(G_LED, LOW); digitalWrite(Y_LED, LOW); digitalWrite(R_LED, HIGH); // RED led on } delay(100); }
-----