hblak22
Published © GPL3+

Stopwatch with Arduino Mega 2560

A quick and easy stopwatch.

BeginnerShowcase (no instructions)1,711
Stopwatch with Arduino Mega 2560

Things used in this project

Story

Read more

Custom parts and enclosures

also same program file

Schematics

it's just blank

connect the wires

Code

Arduino program

C/C++
working stopwatch
// 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);
	 }

Credits

hblak22
1 project • 0 followers

Comments