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: BME280 SerialGPS libmDot mbed-rtos mbed
Revision 1:36e336869699, committed 2016-07-03
- Comitter:
- AshuJoshi
- Date:
- Sun Jul 03 16:00:14 2016 +0000
- Parent:
- 0:3ec6a7645098
- Child:
- 2:866a72c3c3bf
- Commit message:
- Added support for the Grove BME280 based Triple Sensor - Pressure, Humidity and Temperature
Changed in this revision
| BME280.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/BME280.lib Sun Jul 03 16:00:14 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/MACRUM/code/BME280/#ddcaa259e65b
--- a/main.cpp Sun Jul 03 15:45:03 2016 +0000
+++ b/main.cpp Sun Jul 03 16:00:14 2016 +0000
@@ -7,9 +7,12 @@
#include "mbed.h"
#include <math.h>
+ #include "BME280.h"
-// UDK Specific
+// mDot UDK Specific
+// MDot Pinout: https://developer.mbed.org/platforms/MTS-mDot-F411/#pinout-diagram
// Uncomment this line if using a full sized UDK2.0 instead of a Micro UDK
+
#define UDK2 1
#ifdef UDK2
DigitalOut led(LED1);
@@ -17,6 +20,12 @@
DigitalOut led(XBEE_RSSI);
#endif
+//BME280 sensor(I2C_SDA, I2C_SCL)
+// MDot UDK - I2C_SDA and I2C_SCL connected to PC_9/PA_*
+BME280 b280(PC_9, PA_8);
+
+
+
// Globals
Ticker tick;
@@ -24,6 +33,7 @@
void endLessTestLoop();
void setUpLEDBlink();
void blink();
+void readandprintBME280();
/*****************************************************
@@ -33,6 +43,7 @@
// Simple Test Functions, "Hello World on UDK
setUpLEDBlink();
+
endLessTestLoop();
return 0;
@@ -41,14 +52,19 @@
+/*****************************************************
+ * Sensor Functions
+ ****************************************************/
-
+void readandprintBME280() {
+ printf("%2.2f degC, %04.2f hPa, %2.2f %%\n", b280.getTemperature(), b280.getPressure(), b280.getHumidity());
+}
/*****************************************************
-* FUNCTIONS for Simple Testing
-*****************************************************/
+ * FUNCTIONS for Simple Testing
+ ****************************************************/
void setUpLEDBlink(){
// configure the Ticker to blink the LED on 500ms interval
@@ -57,8 +73,10 @@
void endLessTestLoop() {
while(true) {
- printf("Hello world!\r\n");
- wait(3);
+ // printf("Hello world!\r\n");
+ printf("BME280 Sensor: \n");
+ readandprintBME280();
+ wait(5);
}
}