Rep Counter Is Counting Reps for Athletes in Workouts While Showing Motivational Phrases During the Training to Motivate and Push Them Further.
by Romero yhuhui in Circuits > Arduino
10 Views, 0 Favorites, 0 Comments
Rep Counter Is Counting Reps for Athletes in Workouts While Showing Motivational Phrases During the Training to Motivate and Push Them Further.
.jpeg)


This project basically is to help athletes in their workout. As an athlete you will find yourself that you forget how many sets and how many reps but in this project, it will help you to memorize them and giving you motivational messages.
Supplies



I used arduino, ir sensor that detects the rep, lcd screen to show how many reps and a reset button

Here is the attachments of the project itself
Here is the code
include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // Change 0x27 if needed
const int sensorPin = 3;
const int buttonPin = 4; // Restart button pin
int repCount = 0;
bool motionDetected = false;
String messages[] = {
"You got this!",
"Keep pushing!",
"Almost there!",
"Feel the burn!",
"Stronger every rep!",
"Don't give up!",
"Yeahh buddy!"
};
void setup() {
Serial.begin(9600);
pinMode(sensorPin, INPUT);
pinMode(buttonPin, INPUT_PULLUP); // Button with internal pull-up
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Reps: 0");
randomSeed(analogRead(0));
Serial.println("Setup done.");
}
void loop() {
// Check if restart button is pressed (LOW because of pull-up)
if (digitalRead(buttonPin) == LOW) {
repCount = 0;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Reps reset!");
delay(1000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Reps: 0");
Serial.println("Counter reset.");
delay(500); // debounce delay
}
int sensorValue = digitalRead(sensorPin);
Serial.print("Sensor: ");
Serial.println(sensorValue);
if (sensorValue == LOW && !motionDetected) {
repCount++;
motionDetected = true;
Serial.print("Rep counted: ");
Serial.println(repCount);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Reps: ");
lcd.print(repCount);
if (repCount % 10 == 0) {
int msgIndex = random(0, 7);
Serial.print("Message: ");
Serial.println(messages[msgIndex]);
lcd.setCursor(0, 1);
lcd.print(messages[msgIndex]);
delay(3000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Reps: ");
lcd.print(repCount);
}
delay(500);
} else if (sensorValue == HIGH) {
motionDetected = false;
}
}

This is the project with the working LCD