Arduino Counter with LCD display and Push button Tutorial
LCD Counter Arduino for Personal Data Collection - Video made in Fritzing
Hardware
Arduino Uno
Lcd 16x2 i2c (Make sure to have the correct i2c lcd library in your case.)
x 2 switch button
Jumper wire
To set min and max levels, like to stop at 4 and no lower than zero. - set a condition .. if x<0 then x=0; and for not more than 4 .. u can set if x>4 then x =4;
Possible workarounds if code does not work
Your code: LiquidCrystal_I2C lcd(0x3F,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
Changed to: LiquidCrystal_I2C lcd(0x27, 16, 2);
Your code: lcd.init(); // initialize the lcd
Changed to: lcd.begin();