![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Version 8, working version with Alix, sams and ollies code. Displays time, date and sensor info onto terminal, LCD and networking, and saves onto SD card.
Dependencies: BMP280 ELEC350-Practicals-FZ429 TextLCD BME280 ntp-client
Sampler.hpp
- Committer:
- Alix955
- Date:
- 2018-12-31
- Revision:
- 12:4c7eaac8ceef
- Parent:
- 8:7d218affea71
File content as of revision 12:4c7eaac8ceef:
#ifndef _SAMPLER_ #define _SAMPLER_ #include "mbed.h" #include "LCD.hpp" #include "SerialComms.hpp" #include "sample_hardware.hpp" #include "SDcard.hpp" #define Activate_Flag 1 class Sampler { private: public: EventQueue SAMP_Queue; //Initialise the EventQueue void publishSample() { sample_message message = getData(); m_oDisplay.LCD_Queue.call(&m_oDisplay, &LCD_Data::update_sensor_info, message); //Send sensor information to LCD via putting update_sensor_info function onto LCD queue with structure as input m_oSerial.SERIAL_Queue.call(&m_oSerial, &Serialcomms::setsampledata, message); //Send sensor information to Serial via putting setsampledata function onto Serial queue with structure as input m_oNet.Network_Queue.call(&m_oNet, &Network::update_sensor_info, message); //Send sensor information to Network via putting update_sensor_info function onto Network queue with structure as input m_oSD.SDcard_Queue.call(&m_oSD, &SDcard::update_sensor_info, message); //Send sensor information to SD card via putting update_sensor_info function onto SD card queue with structure as input } sample_message getData() { float temp = sensor.getTemperature(); float pressure = sensor.getPressure(); float LDR = adcIn.read()*4095; #ifdef BME float humidity = sensor.getHumidity(); #endif sample_message msg; // Define instance of message structure msg.temp = temp; msg.pressure = pressure; msg.ldr = LDR; return msg; } void updateTimeData(); Sampler() //Constructor { } ~Sampler() //Destructor - should the instance go out of scope, this is called { } }; #endif