# Using the BMP (API v1)

This page applies to the old sensor driver, and is provided here for reference sake. We recommend using the new 'Unified' BMP085 driver (API v2) for any future projects.
To use this sensor and calculate the altitude and barometric pressure, there's a lot of very hairy and unpleasant math. You can check out the math in the datasheet but really, its not intuitive or educational - its just how the sensor works. So we took care of all the icky math and wrapped it up into a nice Arduino library.

You can find the Arduino library repository on github To install it, click this button to download the compressed ZIP file then install it. This guide will help you with the install process if you have never installed an Arduino library.

The same driver is used for both the BMP085 and BMP180!

Restart the IDE

Now you can run this first example sketch

```#include "Wire.h"

void setup() {
Serial.begin(9600);
bmp.begin();
}

void loop() {
Serial.print("Temperature = ");
Serial.println(" *C");

Serial.print("Pressure = ");
Serial.println(" Pa");

Serial.println();
delay(500);
}```
Then open up the serial monitor at 9600 baud. The sketch will continuously print out the temperature in °C and pressure in Pa (Pascals). You can test that the sensor is measuring variations in temperature and pressure by placing your fingertip over the open port hole in the top of the sensor. The temperature and pressure will increase as you can see here:

## Altitude Measurements

Since we know that pressure drops as we gain altitude (that's why air is so thin on mountain-tops) we can compute the current altitude knowing the pressure and temperature. Again, there's a bit of hairy math involved, you can read about the calculations on wikipedia (where this graph is from).
With the Arduino library, we take care of that for you! Simply run this sketch which will return the current altitude based on the pressure.
```#include "Wire.h"

void setup() {
Serial.begin(9600);
bmp.begin();
}

void loop() {
Serial.print("Temperature = ");
Serial.println(" *C");

Serial.print("Pressure = ");
Serial.println(" Pa");

// Calculate altitude assuming 'standard' barometric
// pressure of 1013.25 millibar = 101325 Pascal
Serial.print("Altitude = ");