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.
Dependencies: Servo TMP36 GZ chan_fatfs_sd buffered-serial1 nmea_parser watchdog mbed-rtos mbed
Diff: main.cpp
- Revision:
- 15:ceac642f6b75
- Parent:
- 14:dce4d8c29b17
- Child:
- 16:653df0cfe6ee
diff -r dce4d8c29b17 -r ceac642f6b75 main.cpp
--- 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);
}
}