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: BMP280 ELEC350-Practicals-FZ429 TextLCD BME280 ntp-client
SerialComms.hpp
00001 #include "mbed.h" 00002 00003 class Serialcomms 00004 { 00005 private: 00006 float fTemp; //current temperature of sensor 00007 float fPressure; //current pressure of sensor 00008 float fLDR; //current light level from LDR 00009 00010 public: 00011 EventQueue SERIAL_Queue; //Initialise the EventQueue 00012 00013 void setsampledata(sample_message msg) // Update internal values 00014 { 00015 fTemp = msg.temp; 00016 fPressure = msg.pressure; 00017 fLDR = msg.ldr; 00018 } 00019 00020 sample_message getsampledata() // Retrieves the data 00021 { 00022 sample_message msg; 00023 msg.temp = fTemp; 00024 msg.pressure = fPressure; 00025 msg.ldr = fLDR; 00026 return msg; 00027 } 00028 00029 void updateTerminal() // Print internal values of sensors 00030 { 00031 printf("======= Sensor Update ========\n"); 00032 printf("Temperate: %5.2f\n", fTemp); 00033 printf("Pressure: %5.2f\n", fPressure); 00034 printf("Light Level: %5.2f\n", fLDR); 00035 printf("==============================\n"); 00036 } 00037 00038 void updateTimeDate() 00039 { 00040 } 00041 00042 Serialcomms() 00043 { 00044 printf("Serial Comms Initialised\n"); 00045 } 00046 ~Serialcomms() 00047 { 00048 } 00049 }; 00050 00051 Serialcomms m_oSerial; 00052
Generated on Sat Jul 16 2022 02:51:17 by
