Timer for Working Out - LED Lights

by j07104 in Living > Life Hacks

119 Views, 0 Favorites, 0 Comments

Timer for Working Out - LED Lights

Screen Shot 2021-04-11 at 22.46.25.png

Inspired from: https://www.instructables.com/Flowing-LED-Lights-W...

Topic: I am making a timer for people who are doing workouts. For example, people can't look at their phones when they are doing workouts that need to stay on the ground. In this situation, my product will be able for people to know the time they have spent.

Changes: I changed "wait for 100ms" of delay to "wait for 1000ms", changed "wait for 100ms" of delay to "wait for 50ms", changed "wait for 100ms" of delay to "wait for 150ms", 把秒數由500改至1000.

Code: https://create.arduino.cc/editor/irene1026/05b6a2b...

Supplies

- Arduino Uno board * 1

- USB cable * 1

- Resistor (110Ω) * 8

- LED * 8 - Potentiometer * 1

- Breadboard * 1

- Jumper wires

Build the Circuit

FPM6K9DKNBR24M6.jpeg

1. Plug wires required for these steps into the spots they should work.

2. First plug one wire from "2" to the negative (-).

3. The eight LEDs are connected to pin 2-pin 9.

4. High level and the corresponding LED at the pins will light up.

5. Control the time of each LED brightening and you will see flowing LED lights.

The Schematic Diagram

FLTHT9RJRGOOJJN.png

Procedures

F9GN43WJRGOOJJQ.jpeg

1. Build the circuit.

2. Download the code from https://github.com/primerobotics/Arduino

3. Upload the sketch to the Arduino Uno board

4. Click the Upload icon to upload the code to the control board.

Code

const

int lowestPin = 2;//the lowest one attach to

const int highestPin = 9;//the highest one attach to

/**************************************/

void setup()

{

//set pins 2 through 9 as output

for (int thisPin = lowestPin; thisPin <= highestPin; thisPin++)

{

pinMode(thisPin, OUTPUT); //initialize

}

}

/****************************************/

void loop()

{

//iterate over the pins

//turn the led on from lowest to the highest

for (int thisPin = lowestPin; thisPin <= highestPin; thisPin++)

{

digitalWrite(thisPin, HIGH); //turn this led

delay(100);//wait for 1000 ms

}

//fade from the highest to the lowest

for (int thisPin = highestPin; thisPin >= lowestPin; thisPin--)

{

digitalWrite(thisPin, LOW); //turn this led

delay(100);//wait for 50 ms

}

for (int thisPin = highestPin; thisPin >= lowestPin; thisPin--)

{

digitalWrite(thisPin, HIGH); //turn this led on

delay(100);//wait for 150 ms

}

for (int thisPin = lowestPin; thisPin <= highestPin; thisPin++)

{

digitalWrite(thisPin, LOW); //turn this led

delay(1000);//改,把秒數由500改至1000

}

}