BMP180 and BLE

Dependencies:   BLE_API mbed nRF51822

Fork of WeatherStation by Weather man

Revision:
6:25ed8e2df02e
Parent:
5:fe4888cc60cc
--- a/main.cpp	Mon Dec 21 00:25:08 2015 +0000
+++ b/main.cpp	Wed Jan 10 16:42:44 2018 +0000
@@ -1,19 +1,13 @@
-#define I2C_SDA p3
-#define I2C_SCL p4
+#define I2C_SDA p29
+#define I2C_SCL p28
 
 #include "mbed.h"
 #include "BLE.h"
-#include "battery.h"
 #include "WeatherService.h"
-#include "BatteryService.h"
 #include "BMP180.h"
-#include "SHT21_ncleee.h"
-
 
 float temperature1;
-float temperature2;
 float pressure;
-float humidity;
 
 BLE ble;
 
@@ -22,15 +16,13 @@
 DigitalOut instrumentsPower(p30);
 
 BMP180 bmp180;
-SHT21 sht21(&i2c);
 
 
 const static char DEVICE_NAME[] = "Weather Station";
 
 static const uint16_t serviceList[] = {
-    GattService::UUID_ENVIRONMENTAL_SERVICE, 
-    GattService::UUID_BATTERY_SERVICE
-};
+    GattService::UUID_ENVIRONMENTAL_SERVICE
+    };
 
 static volatile bool triggerSensorPolling = false;
 
@@ -69,10 +61,6 @@
     pressure = (float)bmp180.BMP180GetPressure();
 }
 
-void updateFromSHT21() {
-    temperature2 = sht21.readTemp();
-    humidity = sht21.readHumidity();
-}
 
 int main(void)
 {
@@ -89,8 +77,6 @@
 
     /* Setup weather service. */
     WeatherService weatherService(ble);
-    BatteryService batteryService(ble, 0);
-    Battery battery(BATTERY_PIN);
 
     /* setup advertising */
     ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE);
@@ -109,25 +95,18 @@
             instrumentsPower = 1;
             wait(1);
             updateFromBMP180();
-            updateFromSHT21();
             instrumentsPower = 0;
             
-            float temperature = (temperature1 + temperature2) / 2;
+            float temperature = (temperature1)/ 2;
             
             printf("Temp1: %.1f ºC \n", temperature1);
-            printf("Temp2: %.1f ºC \n", temperature2);
             printf("Temp Avg.: %.1f ºC \n", temperature);
             printf("Pressure: %.3f Pa \n", pressure);
-            printf("Humidity: %.1f%% \n", humidity);
             printf("---\n");
-
-            
+ 
             weatherService.updateTemperature(temperature);
             weatherService.updatePressure(pressure);
-            weatherService.updateHumidity(humidity);
-                        
-            
-            batteryService.updateBatteryLevel(battery.read());
+
         } else {
             ble.waitForEvent();
         }