Introduction: Push-up Arduino

That's a simple push-up meter

You need an Arduino, HC-SR04 and creativity for how to attach to your body

Step 1: Connections

Trig pin is on 13
Echo pin is on 12
Vcc = 5v
Gnd = gnd

Step 2:

Step 3:

#define trigPin 13
#define echoPin 12

int i;

void setup() {

Serial.begin (9600);

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

}

void loop() {

long duration, distance;

digitalWrite(trigPin, LOW); // Added this line

delayMicroseconds(2); // Added this line

digitalWrite(trigPin, HIGH);

// delayMicroseconds(1000); - Removed this line

delayMicroseconds(10); // Added this line

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distance = (duration/2) / 29.1;

if (distance >= 40 || distance <= 0){

//Serial.print("Out of range");

(distance = i);

(i++); //With every "out of range" there is +1 push up

Serial.print("/////" );

Serial.println(i);

}

delay(1000);

}

Step 4: Output

When is going to "out of range" there is a one more push - up!
Everything is in the code