Let's hang out after the marathon
and go to the gym
I imagine the lady in the purple shirt is thinking, "this guy is too happy to be running."
Portland Rock 'n' Roll 1/2 Marathon
taken by Dena Rosko on 5/20/2012
Haiku : Technology : Running
int ledPin = 12;
int sensorPin = 0;
double alpha = 0.60;
int period = 20;
double change = 0.0;
int goingUpSeries = 0;
void setup()
{
pinMode(ledPin, OUTPUT);
Serial.begin(115200);
}
void loop()
{
static double oldValue = 0;
static double oldChange = 0;
int rawValue = analogRead(sensorPin);
double value = alpha * oldValue + (1 - alpha) * rawValue;
Serial.print(rawValue);
Serial.print(",");
Serial.println(value);
change = value - oldValue;
digitalWrite(ledPin, isGoingUp(change, oldChange));
oldValue = value;
oldChange = change;
delay(period);
}
boolean isGoingUp(double change, double oldChange) {
return (change < 0.0 && oldChange > 0.0);
}
/*
* Example Arduino sketch
*/
int ledPinYellow = 10;
int ledPinGreen = 12;
void setup() {
pinMode(ledPinYellow, OUTPUT);
pinMode(ledPinGreen, OUTPUT);
}
void loop() {
digitalWrite(ledPinGreen, LOW);
digitalWrite(ledPinYellow, HIGH);
delay(250);
digitalWrite(ledPinYellow, LOW);
digitalWrite(ledPinGreen, HIGH);
delay(250);
}