Generation 3 of the Harp project

Dependencies:   Servo TMP36 GZ buffered-serial1 chan_fatfs_sd nmea_parser watchdog mbed-rtos mbed

Fork of HARP2 by Tyler Weaver

Files at this revision

API Documentation at this revision

Comitter:
tylerjw
Date:
Wed Dec 12 16:45:23 2012 +0000
Parent:
14:dce4d8c29b17
Child:
16:653df0cfe6ee
Commit message:
working BMP085 sampling

Changed in this revision

BMP085.lib Show annotated file Show diff for this revision Revisions of this file
ITG3200.lib Show annotated file Show diff for this revision Revisions of this file
chan_fatfs_sd.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BMP085.lib	Wed Dec 12 16:45:23 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/tylerjw/code/BMP085/#0b4c4632aeb0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ITG3200.lib	Wed Dec 12 16:45:23 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/tylerjw/code/ITG3200/#e61fe4b74daa
--- a/chan_fatfs_sd.lib	Wed Dec 12 16:22:09 2012 +0000
+++ b/chan_fatfs_sd.lib	Wed Dec 12 16:45:23 2012 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/tylerjw/code/chan_fatfs_sd/#d770e6821de6
+http://mbed.org/users/tylerjw/code/chan_fatfs_sd/#f84cf96bb008
--- a/main.cpp	Wed Dec 12 16:22:09 2012 +0000
+++ b/main.cpp	Wed Dec 12 16:45:23 2012 +0000
@@ -2,6 +2,14 @@
 #include "rtos.h"
 #include "buffered_serial.h"
 #include "ff.h"
+#include "BMP085.h"
+#include "ITG3200.h"
+
+I2C i2c(p9, p10); // sda, scl
+BMP085 alt_sensor(i2c);
+
+I2C i2c_2(p28,p27);
+
 
 #define CELLS       3.0
 #define LIPO_EMPTY  3.4
@@ -52,7 +60,6 @@
 {
     FATFS fs;
     FIL fp_gps, fp_sensor;
-    char buffer[80];
 
     DigitalOut log_led(LED3);
 
@@ -90,7 +97,7 @@
     DigitalOut sensor_led(LED2);
     
     sensor_line *message = mpool_sensor_line.alloc();
-    strcpy(message->line, "GPS Battery,\r\n");
+    strcpy(message->line, "GPS Battery,BMP085 Temperature,BMP085 Pressure,BMP085 Altitude(ft)\r\n");
     queue_sensor_line.put(message);
     
     while(true)
@@ -103,12 +110,17 @@
         float sample = gps_battery.read();
         float gps_battery_voltage = sample*BAT_MUL*3.3;
         
+        //BMP085
+        int bmp_temperature = alt_sensor.get_temperature();
+        int bmp_pressure = alt_sensor.get_pressure();
+        float bmp_altitude = alt_sensor.get_altitude_ft();
+        
         // more sensors
         
-        sprintf(message->line, "%f,\r\n", gps_battery_voltage);
+        sprintf(message->line, "%f,%d,%d,%f\r\n", gps_battery_voltage,bmp_temperature,bmp_pressure,bmp_altitude);
         queue_sensor_line.put(message);
         sensor_led = 0;        
-        Thread::wait(1000);
+        Thread::wait(100);
     }
 }