Make an Arduino Gym Circuit Lights
This code and circuit setup are used in a gymnasium on the cardio circuit. Gym members move from one circuit apparatus to the next by following the green and red LED strips. The red LED indicates the rest or change period while the green LED indicates the active exercise period, and members keep following it until the whole circuit is done.
During the rest or change period, the red LED is turned on for 20 seconds, giving the members time to rest or change the exercise apparatus. After the rest period, the green LED turns on for 40 seconds, indicating the active exercise period. Members perform the exercise until the green LED turns off.
The buzzer is used to alert members when it's time to switch from the rest period to the active exercise period and vice versa. It beeps for one second at the start of each period.
This circuit setup is an excellent way to keep members on track during their cardio circuit training. The LED strips provide a clear visual indication of when to rest and when to start the exercise, and the buzzer provides an audible signal to switch between the two. It helps members to stay on schedule and ensure they complete the entire circuit.
This code is controlling three LEDs and a buzzer using an Arduino board. The red LED is connected to pin 10, the green LED is connected to pin 11, and the buzzer is connected to pin 12. The third LED, connected to pin 13, is not used in the loop but is set to low in the setup function.
In the setup function, all the pins are set to output mode. The LED connected to pin 12 is set to high, causing the buzzer to beep for one second. Then, the LED connected to pin 12 is set to low.
In the loop function, the red LED is turned on for 20 seconds using digitalWrite(10, HIGH), followed by a delay of 20 seconds using delay(20000), and then turned off using digitalWrite(10, LOW). Then, the LED connected to pin 12 is turned on for one second to make the buzzer beep again, and then turned off.
Next, the green LED is turned on for 40 seconds using digitalWrite(11, HIGH), followed by a delay of 40 seconds using delay(40000), and then turned off using digitalWrite(11, LOW). Again, the LED connected to pin 12 is turned on for one second to make the buzzer beep, and then turned off.
This loop continues indefinitely, alternating between the red and green LEDs, and sounding the buzzer every time a new LED is turned on.
NOTES:
Drive led strips with FET transistors as well as a 12v buzzer.
int redLed = 10;
int greenLed = 11;
int led = 13;
int buzPin = 12;
void setup() {
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
digitalWrite(12, HIGH);
delay(1000);
digitalWrite(12, LOW);
}
void loop() {
digitalWrite(10, HIGH); //red
delay(20000);
digitalWrite(10, LOW);
digitalWrite(12, HIGH);
delay(1000);
digitalWrite(12, LOW);
digitalWrite(11, HIGH); //green
delay(40000);
digitalWrite(11, LOW);
digitalWrite(12, HIGH);
delay(1000);
digitalWrite(12, LOW);
}