Version 5

Dependencies:   BMP280 TextLCD BME280

SerialComms.hpp

Committer:
O_Thom
Date:
2018-11-29
Revision:
7:8664a45f5ce1
Parent:
6:b7f6e0c0f646
Child:
8:7d218affea71

File content as of revision 7:8664a45f5ce1:

#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()
        {
        }  
};

Serialcomms m_oSerial;