Version 5
Dependencies: BMP280 TextLCD BME280
Diff: SerialComms.hpp
- Revision:
- 6:b7f6e0c0f646
- Parent:
- 1:f89c930c6491
- Child:
- 7:8664a45f5ce1
diff -r f87129ac8bf3 -r b7f6e0c0f646 SerialComms.hpp --- a/SerialComms.hpp Thu Nov 29 16:08:28 2018 +0000 +++ b/SerialComms.hpp Thu Nov 29 18:41:57 2018 +0000 @@ -1,8 +1,49 @@ -class Serial +#include "mbed.h" + +class Serialcomms { private: - + float fTemp; //current temperature of sensor, updated every 15 seconds + float fPressure; //current pressure of sensor, updated every 15 seconds + float fLDR; //current light level from LDR, updated every 15 seconds + public: + EventQueue SERIAL_Queue; //Initialise the EventQueue + + void setsampledata(sample_message msg) // Update internal values + { + fTemp = msg.temp; + fPressure = msg.pressure; + fLDR = msg.ldr; + } + + sample_message getsampledata() // Retrieves the data + { + sample_message msg; + msg.temp = fTemp; + msg.pressure = fPressure; + msg.ldr = fLDR; + return msg; + } + + void updateTerminal() // Print internal values of sensors + { + printf("======= Sensor Update ========\n"); + printf("Temperate: %5.2f\n", fTemp); + printf("Pressure: %5.2f\n", fPressure); + printf("Light Level: %5.2f\n", fLDR); + printf("==============================\n"); + } - + void updateTimeDate() + { + } + + Serialcomms() + { + printf("Serial Comms Initialised\n"); + } + ~Serialcomms() + { + } };