I’m trying to do just the same. So far my code looks like this:
float altitude;
float prevAltitude = 0;
float verticalSpeed = 0;
void loop()
{
float pressure = bmp085GetPressure(bmp085ReadUP());
altitude = calcAltitude(pressure); //Uncompensated caculation - in Meters
verticalSpeed = prevAltitude - altitude;
prevAltitude = altitude;
Serial.print("Altitude: "); //this will go to a display later
Serial.print(altitude, 2); //display 2 decimal places
Serial.println(" M");
Serial.print("Vertical Speed:" );//dito
Serial.print(verticalSpeed, 1);
Serial.println("m/s");
if (verticalSpeed > 0.3)
{playTone(verticalSpeed); //I have added a dc beeper to my circuit, I'm currently tweaking the beeps. My ears bleed.
delay(1000); //I'll probably change this value to 250 or so. I need it for paragliding where even small lifts count.
}