hi, yesterday i prepared a liquid crystal display set, managed to connect it right but, for some reasons my display doesen't work, i doubled checked if i had everything setted right, and it was done right, so i guess the problem is in the code
anyone can help
#include<LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
const int switchPin= 6;
int switchState= 0;
int prevSwitchState=0 ;
int reply;
void setup() {
lcd.begin(16,2);
pinMode(switchPin,INPUT);
lcd.print("will you lose?");
lcd.setCursor(0,1);
lcd.print("or will you win?");
}
void loop() {
switchState = digitalRead(switchPin);
if (switchState !=prevSwitchState);{
if (switchState == LOW); {
reply = random(2);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("hai");
lcd.setCursor(0,1);
switch (reply) {
case 0:
lcd.print ("you lost.");
break;
case 1:
lcd.print ("you won!");
}
}}
prevSwitchState = switchState;