![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
jaajajajaj
Revision 0:e26d80fab794, committed 2016-10-15
- Comitter:
- dimmu8410
- Date:
- Sat Oct 15 15:10:17 2016 +0000
- Commit message:
- Example
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BMP180.lib Sat Oct 15 15:10:17 2016 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/kgills/code/BMP180/#b2219e6e444b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Oct 15 15:10:17 2016 +0000 @@ -0,0 +1,41 @@ +#include <stdio.h> +#include "mbed.h" +#include "BMP180.h" + +I2C i2c(I2C_SDA, I2C_SCL); +Serial pc(USBTX,USBRX); +BMP180 bmp180(&i2c); + +int main(void) { + + while(1) { + if (bmp180.init() != 0) { + pc.printf("NO SE PUDO COMUNICAR\n"); + } else { + pc.printf("BMP180 FUNCIONO\n"); + break; + } + wait(1); + } + + while(1) { + bmp180.startTemperature(); + wait_ms(5); // Wait for conversion to complete + float temp; + if(bmp180.getTemperature(&temp) != 0) { + pc.printf("NO SE PUDO LEER LA TEMP\n"); + continue; + } + + bmp180.startPressure(BMP180::ULTRA_LOW_POWER); + wait_ms(10); // Wait for conversion to complete + int pressure; + if(bmp180.getPressure(&pressure) != 0) { + pc.printf("Error Leyendo la presion\n"); + continue; + } + + pc.printf("Presion = %d Pa Temperatura = %f C\n\r", pressure, temp); + wait(1); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Oct 15 15:10:17 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3 \ No newline at end of file