Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
- Committer:
- newk8600
- Date:
- 2012-11-09
- Revision:
- 3:ae2b8103e52b
- Parent:
- 2:8c00953d4755
File content as of revision 3:ae2b8103e52b:
/*
*@file main.cpp
*
*
*
*
* 1.8 - 3.6V (Vdd)
* 1.62 - 3.6 (Vddio)
*
*
*Altitude = 44330*(1-(p/p0)^(1/5.255))
* set p0 to sealevel pressure
* delta p = 1hPa = 8.43m at sea level
*
*/
/*
*Pinout:
*pin9 = SDA
*pin10 = SCL
*pin11 = XCLR (digital out; active low; Resets sensor)
*pin12 = EOC ("end of conversation"; signal when conversion finished)
*
*/
#include "mbed.h"
#include "BMP085.h"
I2C i2c(p9, p10); // sda, scl
BMP085 alt_sensor(i2c);
Serial pc(USBTX, USBRX); // tx, rx
int main()
{
pc.baud(9600);
//alt_sensor.display_cal_param(&pc);
while(1) {
pc.printf("Temperature: %d\r\n", alt_sensor.get_temperature());
pc.printf("Pressure: %d\r\n", alt_sensor.get_pressure());
pc.printf("Altitude: %f\r\n", alt_sensor.get_altitude_ft());
wait(0.5);
}
