i had a simple counter ongoing. a basic increment function. the code was running well and functioning properly but suddenly the arduino turned off. i removed the plug and plugged in again but the lights blinked once and the board turned off, or rather didnt turn on at all. now it isnt even registered and not showing on the com3 port, is my board damaged?
this is the code i was using:
#include <LiquidCrystal_I2C.h>
const int buttonPin1 = 2, buttonPin2 = 3;
int button1_State = 0, button2_State = 0;
int count_value =0;
int prestate =0;
LiquidCrystal_I2C lcd(0x27,16,2);
void setup()
{
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
lcd.init();
lcd.backlight();
lcd.setCursor(4,0);
lcd.print("Count:");
lcd.setCursor(2,1);
lcd.print(count_value);
}
void loop()
{
button1_State = digitalRead(buttonPin1);
button2_State = digitalRead(buttonPin2);
if (button1_State == HIGH && prestate == 0)
{
count_value++;
lcd.setCursor(0,1);
lcd.print("> ");
lcd.print(count_value);
lcd.print(" ");
prestate = 1;
}
else if(button1_State == LOW && button2_State == LOW)
{
prestate = 0;
}
}
this is my setup:
and this is whats happening:
what should i do?