Hello everyone,
How can I just show the output once on the screen not repeatedly? Or in short how can write the below code outside loop?
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int button1 = 6; //first button is on pin 8
const int button2 = 7;
int currentButtonState1=0;
int currentButtonState2=0;
void setup(){
pinMode(button1, INPUT);
pinMode(button2, INPUT);
lcd.begin(16,2);
}
void loop(){
currentButtonState1= digitalRead(button1);
currentButtonState2= digitalRead(button2);
if(currentButtonState1 == HIGH){
lcd.print("correct");
}
else if (currentButtonState2 == HIGH)
{
lcd.print("wrong");
}
}