Juri Pfammatter / Mbed OS LUTRv1

Dependencies:   PM2_Libary Adafruit_GFX BME680

Files at this revision

API Documentation at this revision

Comitter:
pfammjur
Date:
Wed Apr 21 17:10:04 2021 +0000
Parent:
1:1f6bc8e30cd5
Child:
3:81509cdb4b15
Commit message:
Float Zahlen implementiert

Changed in this revision

BME680OLED.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
--- a/BME680OLED.cpp	Tue Apr 20 17:46:46 2021 +0000
+++ b/BME680OLED.cpp	Wed Apr 21 17:10:04 2021 +0000
@@ -53,7 +53,7 @@
 
 
 void setup(){                                   //Setup wird 1 mal durchlaufen
-    thread_sleep_for(1000);
+    thread_sleep_for(1000);                     //Logo Anzeigen lassen
     pc.set_baud(9600);                          //baudrate
     oled.clearDisplay();
     oled.drawPixel (10, 10,WHITE);
@@ -74,12 +74,18 @@
     while(true)
     {
         oled.setTextCursor(0,0);
+        
+        //Zeit
+        
+        
+        //BME680
         if (bme680.performReading()) {                                                                          //Sensor auslesen
-            oled.printf("Temperatur: %d.%d C \r\n",(static_cast<int>(bme680.getTemperature())),(static_cast<int>(bme680.getTemperature()*100.0))%100);
-            oled.printf("Humidity: %d.%d %% \r\n",(static_cast<int>( bme680.getHumidity())),(static_cast<int>( bme680.getHumidity()*100.0))%100);
-            oled.printf("Pressure: %d hPa \r\n",(static_cast<int>( bme680.getPressure()))/100);
-            oled.printf("VOC: %d KOhms \r\n",(static_cast<int>(bme680.getGasResistance()/10000.0)));
+            oled.printf("Temperatur: %.2f C \r\n",bme680.getTemperature());
+            oled.printf("Humidity: %.2f %% \r\n",bme680.getHumidity());
+            oled.printf("Pressure: %d hPa \r\n",static_cast<int>(bme680.getPressure()/10));
+            oled.printf("VOC: %d KOhms \r\n",(static_cast<int>(bme680.getGasResistance()/1000.0)));
             oled.display();
+            
         }else{
             printf("Failed to perform reading :(\n");
         }    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Wed Apr 21 17:10:04 2021 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#c73413893fb98aaaeda74513c981ac68adc8645d
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app.json	Wed Apr 21 17:10:04 2021 +0000
@@ -0,0 +1,7 @@
+{
+    "target_overrides": {
+        "*": {
+            "target.printf_lib": "std"
+        }
+    }
+}