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:
- Cirrus01
- Date:
- 2015-09-12
- Revision:
- 0:116f8291dc01
- Child:
- 1:03d398b1eb4b
File content as of revision 0:116f8291dc01:
#include "mbed.h" #include "BMP183.h" //DigitalOut my_led(LED1); DigitalOut ChipSelectBaro(D2); Serial serial(SERIAL_TX, SERIAL_RX); SPI spi(SPI_MOSI, SPI_MISO, SPI_SCK); uint8_t status; int main() { Timer t; BMP183 baro(SPI_MOSI, SPI_MISO, SPI_SCK, D2); int time; bool go = false; serial.baud(115200); serial.printf("Communication ready!\n"); serial.printf("Initiating Baro...\n"); status = baro.getID(); if(status != 0x55) { go = false; serial.printf("Communication to Baro failed...\n"); } else { serial.printf("Baro OK!\n\r"); go = true; } serial.printf("Getting calibration data...\n"); baro.getCalibrationData(); serial.printf("Done...\n\n"); t.start(); while(go) { // Read sensor t.reset(); baro.read(); time = t.read_ms(); serial.printf("Time: %i - Temp.: %f - Pres.: %f - Alt.: %f\n", time, baro.Temperature, baro.Pressure, baro.Altitude); } }