// created by harrison blaker on october 25, 2019
#include <LiquidCrystal_I2C.h>
const int buttonPin = 2;
LiquidCrystal_I2C lcd(0x20,16,2); // set the LCD address to 0x20 for a 16 chars and 2 line display
int timer = 0;
int timer2 = 0;
int timer3;
int buttonState = 0;
int toggle = 0;
void setup()
{
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
lcd.print("stop watch");
pinMode(buttonPin, INPUT);
}
void loop()
{
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH);
{
int toggle = toggle + 1;
}
int timer;
int timer2;
int toggle;
if (toggle >= 2)
int toggle = 0;
{
int timer = 0;
}
while (toggle = 0) {
// turn LED on:
lcd.clear();
buttonState = digitalRead(buttonPin);
int timer = timer + 1;
lcd.setCursor(0,1);
lcd.print(timer);
lcd.setCursor(0,0);
lcd.print("seconds counter");
delay (1000);
}
Comments