Nicholas Outram / Mbed OS sarbir

Dependencies:   CheckRTC LPS25H hts221

Fork of ELEC350-extended-referral2 by satbir panesar

Files at this revision

API Documentation at this revision

Comitter:
martinsimpson
Date:
Mon Mar 27 09:35:05 2017 +0000
Parent:
31:d960851a7d2c
Child:
33:cffe0ae69aa6
Commit message:
OS 5.3 Veriso 2017

Changed in this revision

LPS25H.lib Show annotated file Show diff for this revision Revisions of this file
hts221.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/LPS25H.lib	Mon Mar 27 09:35:05 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/kenjiArai/code/LPS25H/#8fc511bd51af
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hts221.lib	Mon Mar 27 09:35:05 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/Delta/code/hts221/#d255cebab3f5
--- a/main.cpp	Tue Mar 14 14:00:04 2017 +0000
+++ b/main.cpp	Mon Mar 27 09:35:05 2017 +0000
@@ -1,4 +1,54 @@
 #include "mbed.h"
+#include "rtos.h"
+#include "hts221.h"
+#include "LPS25H.h"
+
+
+DigitalOut myled(LED1);
+I2C i2c2(I2C_SDA, I2C_SCL);
+
+float tempCelsius = 25.50;
+float humi = 55;
+int humiMax = 100; 
+char cmd=0;
+uint32_t seconds = 0, minutes=0, hours=0; 
+
+LPS25H barometer(i2c2, LPS25H_V_CHIP_ADDR);
+
+
+
+int main()
+  {
+  hts221_init();
+  HTS221_Calib();
+  printf("SOFT253 simple Temperature Humidity and Pressure Sensor Monitor\n\r");
+  printf("Using the X-NUCLEO-IKS01A1 shield and MBED Libraries\n\r");
+    //printf("%#x\n\r",barometer.read_id());
+    
+  while(1) 
+    {
+      cmd=NULL;
+      while(cmd==NULL){cmd=getchar();}
+      if(cmd=='?'){
+        printf("SOFT253 simple Temperature Humidity and Pressure Sensor Monitor\n\r");
+        printf("Using the X-NUCLEO-IKS01A1 shield and MBED Libraries\n\r");
+      }
+      if(cmd=='A'){
+        HTS221_ReadTempHumi(&tempCelsius, &humi);
+        printf("%4.2fC %3.1f%%", tempCelsius, humi);
+        barometer.get();
+        printf(" %6.1f %4.1f\r\n", barometer.pressure(), barometer.temperature());
+        myled = 1; // LED is ON
+        Thread::wait(200); // 200 ms NB 'Thread::wait(int d);' !!! d is in milliseconds! 
+        myled = 0; // LED is OFF
+        Thread::wait(100); // 100 ms
+      }
+    }
+  }
+  
+
+
+/*#include "mbed.h"
 
 DigitalOut led1(LED1);
 
@@ -9,4 +59,4 @@
         wait(0.5);
     }
 }
-
+*/