Hello everyone,
I'm actually programming for a project in wich i need to use a 16*2 LCD display with a potentiometer. The LCD has to show different message in fonction of the tension of the potentiometer. I start with this programm but i'm really bad at that, if you can help me.
//LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// on définit la constante en donnant un nom et un nombre.
int Pot; //déclaration de la variable qui va stocker la valeur numérique de la tension du potentiomètre
void setup()
{
Serial.begin(9600); //Initialisation de la communication avec la console
}
void loop()
{
Pot=analogRead(A0); //On stocke la valeur lue par le CAN A0 dans la variable valeurPot
Serial.print("Valeur lue : ");Serial.println(Pot);
if (Pot>769)&&(Pot<1023)
{
Serial.println("Ensoleillé");
}
else if (Pot>513)&&(Pot<769)
{
Serial.println("Couvert");
}
else if (Pot>254)&&(Pot<512)
{
Serial.println("Nuageux");
}
else
{
Serial.println("Pluie");
}
}
ProgrammeLCD_Potentiometre.ino (731 Bytes)