Recitation 3: Workout

  1. The challenge was kind of hard and we attempted to code it so that the circuit would buzz to celebrate the completion of the training, but we don’t know how to choose the node on the Arduino Uno board for buzzing. And here is the video for step 4.
  2. Code:

int SENSOR_PIN = 2;
int tiltVal;
int prevTiltVal;

void setup() {
pinMode(SENSOR_PIN, INPUT); // Set sensor pin as an INPUT pin
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}

void loop() {
// read the state of the sensor
tiltVal = digitalRead(SENSOR_PIN);
// if the tilt sensor value changed, print the new value
if (tiltVal != prevTiltVal && tiltVal == 1) {
Serial.println(“Bicep curl completed”);
Serial.println(x);
x = x+1;
}
if (tiltVal != prevTiltVal) {
prevTiltVal = tiltVal;
}
if (x == 8){
Serial.println(“Yay, you’ve done one set of curls!”);
x = 0;
}
delay(10);
}

  1. The angle for the tilt to be sensed was approximately the 60-90 degree. One serious problem we have was that when I dropped the arm the counter also stepped up by one, instead of incrementing only if I raised and dropped my arm as a set. So we have to change the code for it to count it the way we wanted, that was to include “1” and “0” as a set. One interesting fact we found was that rotating and whipping also counted.

     And when we held the wires several centimeters away and tilted it, it seems that its sensitiveness dropped and counted in a rather slow way. I think it could be used by any users for not only bicep. It could be practiced in any physical exercises that include curving of joints. 

Leave a Reply

Your email address will not be published. Required fields are marked *