jaajajajaj

Dependencies:   BMP180 mbed

Files at this revision

API Documentation at this revision

Comitter:
dimmu8410
Date:
Sat Oct 15 15:10:17 2016 +0000
Commit message:
Example

Changed in this revision

BMP180.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r e26d80fab794 BMP180.lib
--- /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
diff -r 000000000000 -r e26d80fab794 main.cpp
--- /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);
+    }
+}
diff -r 000000000000 -r e26d80fab794 mbed.bld
--- /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