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: CheckRTC LPS25H hts221
Fork of ELEC350-extended-referral2 by
Revision 47:12f18a4527d8, committed 2017-11-23
- Comitter:
- noutram
- Date:
- Thu Nov 23 11:50:35 2017 +0000
- Parent:
- 46:794973f66ef6
- Commit message:
- Suggestions
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Nov 23 11:40:53 2017 +0000
+++ b/main.cpp Thu Nov 23 11:50:35 2017 +0000
@@ -26,7 +26,13 @@
char *buf;
size_t sz;
+typedef struct {
+ float temp;
+ float press;
+ float humid;
+} measurement;
+measurement buffer [120];
LPS25H barometer(i2c2, LPS25H_V_CHIP_ADDR);
HTS221 humidity(I2C_SDA, I2C_SCL);
@@ -119,17 +125,25 @@
while (true) {
Thread::signal_wait(99);
//Get samples
- humidity.ReadTempHumi(&tempCelsius, &humi); // reads temperature and humity levels
- barometer.get(); // gets barometer readings
- //Put in buffer
- typedef struct {
- float temp;
- float press;
- float humid;
- } measurement;
- measurement buffer [120];
+ measurement m;
+
+ float pressure = barometer.pressure();
+ m.pressure = pressure;
+ float temp;
+ float humidity;
+ humidity.ReadTempHumi(&temp, &humidity); // reads temperature and humity levels
+ m.humidity = humidity;
+ m.temperature = temp;
+
+ buffer[oldest] = m;
+
+ //update oldest
+ oldest++;
+ //wrap back to zero if at the end
+ //TO DO
+
}
