hi, I do have a problem with displaying the lcd. when there is a present of analogRead command the switch statement produced stack output on LCD. even though lcd.Clear command is inserted it being ignored. but when i remove the analogread command the display functioning well... its like the command can only do the digital operation but not analog...
is there any appropriate setup to use analogread command in switch statement??
thank you,.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int x=1;
int sensor1= A0;
int sensor2= A1;
int s1;
int s2;
void setup()
{
lcd.begin(16, 2);
pinMode(sensor1,INPUT);
pinMode(sensor2,INPUT);
}
void loop() {
s1 = analogRead(sensor1);
s2 = analogRead(sensor2);
switch (x) {
case 1:
lcd.print("hello, world!");
delay(1000);
lcd.clear();
delay(1000);
break;
case 0:
{
lcd.print("bye world");
break;
}
}
}