Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ARDUINO with LCD Make a stop watch with accuracy of about 0.01 seconds. The stop

ID: 2081410 • Letter: A

Question

ARDUINO with LCD

Make a stop watch with accuracy of about 0.01 seconds.
The stopwatch will be started and stopped with a pushbutton.
Stopwatch value is displayed in line 2.
Press the switch to bring the stopwatch between three states:
(RDY, RUN, RES, RDY, RUN ...
RDY Display will show: RDY 00: 00: 00,00
RUN Display will show: RUN XX: XX: XX, XX
RES Display will show: RES 00: 12: 36.30
In state RUN display should be updated every 0.1 sec as we are accustomed to with
stopwatches.
Change of state and start / stop / reset time must be triggered by rising edge (0 to 1 change)
the signal from the pushbutton.

Explanation / Answer

First of all for making an stopwatch using arduino with LCD Display you need following things:

1 Arduino best if buy Arduino Uno, but any standard Arduino is appropriate for this project.

1 breadboard.

1 LCD character display.

1 10K potentiometer. You can use a potentiometer of any value, but you may have to adjust the resistors you use if you use a potentiometer that isn’t 10K.

2 tactile buttons Any push-button switch will do!

[1 10K resistor]

[1 10K resistor]

Wires for wiring.

Stopwatch will use two buttons: one to start or reset the count and another to stop counting and show the elapsed time.

Connect all the things to arduino uno board and write the code and execute the program

// Project -creating a stopwatch

unsigned long start, finished, elapsed;

void setup()

{

Serial.begin(9600);

pinMode(2, INPUT); // the start button

pinMode(3, INPUT); // the stop button

Serial.println("Press 1 for Start/reset, 2 for elapsed time");

}

void displayResult()

{

float h, m, s, ms;

unsigned long over;

elapsed = finished - start;

h = int(elapsed / 3600000);

over = elapsed % 3600000;

m = int(over / 60000);

over = over % 60000;

s = int(over / 1000);

ms = over % 1000;

Serial.print("Raw elapsed time: ");

Serial.println(elapsed);

Serial.print("Elapsed time: ");

Serial.print(h, 0);

Serial.print("h ");

Serial.print(m, 0);

Serial.print("m ");

Serial.print(s, 0);

Serial.print("s ");

Serial.print(ms, 0);

Serial.println("ms");

Serial.println();

}

void loop()

{

if (digitalRead(2) == HIGH)

{

start = millis();

delay(200); // for debounce

Serial.println("Started...");

}

if (digitalRead(3) == HIGH)

{

finished = millis();

delay(200); // for debounce

displayResult();

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote