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

Committer:
O_Thom
Date:
Thu Nov 29 18:41:57 2018 +0000
Revision:
6:b7f6e0c0f646
Parent:
5:f87129ac8bf3
Child:
7:8664a45f5ce1
Working threads. Tested LCD and Sampler. Serial Pending.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
O_Thom 5:f87129ac8bf3 1 #ifndef _SAMPLER_
O_Thom 5:f87129ac8bf3 2 #define _SAMPLER_
O_Thom 0:f9a18207d99c 3 #include "mbed.h"
O_Thom 5:f87129ac8bf3 4 #include "LCD.hpp"
O_Thom 6:b7f6e0c0f646 5 #include "sample_hardware.hpp"
O_Thom 0:f9a18207d99c 6 #define Activate_Flag 1
O_Thom 0:f9a18207d99c 7
O_Thom 0:f9a18207d99c 8 class Sampler
O_Thom 0:f9a18207d99c 9 {
O_Thom 0:f9a18207d99c 10 private:
O_Thom 6:b7f6e0c0f646 11
O_Thom 2:38d31b2e0956 12 public:
O_Thom 6:b7f6e0c0f646 13 EventQueue SAMP_Queue; //Initialise the EventQueue
O_Thom 6:b7f6e0c0f646 14
O_Thom 3:82612f4ae4c5 15 void publishSample()
O_Thom 3:82612f4ae4c5 16 {
O_Thom 6:b7f6e0c0f646 17 sample_message message = getData();
O_Thom 6:b7f6e0c0f646 18 m_oDisplay.LCD_Queue.call(&m_oDisplay, &LCD_Data::update_sensor_info, message);
O_Thom 5:f87129ac8bf3 19 //SD_Queue.call(&m_oSD_data, &SD_Queue::update_sensor_info, sample_data, sample_data);
O_Thom 5:f87129ac8bf3 20 //SERIAL_Queue.call(&m_oSERIAL_data, &SERIAL_Queue::update_sensor_info, sample_data, sample_data);
O_Thom 3:82612f4ae4c5 21 }
O_Thom 6:b7f6e0c0f646 22
O_Thom 6:b7f6e0c0f646 23 sample_message getData()
O_Thom 6:b7f6e0c0f646 24 {
O_Thom 5:f87129ac8bf3 25 float temp = sensor.getTemperature();
O_Thom 5:f87129ac8bf3 26 float pressure = sensor.getPressure();
O_Thom 6:b7f6e0c0f646 27 float LDR = adcIn.read();
O_Thom 5:f87129ac8bf3 28 #ifdef BME
O_Thom 5:f87129ac8bf3 29 float humidity = sensor.getHumidity();
O_Thom 5:f87129ac8bf3 30 #endif
O_Thom 6:b7f6e0c0f646 31 sample_message msg; // Define instance of message structure
O_Thom 6:b7f6e0c0f646 32 msg.temp = temp;
O_Thom 6:b7f6e0c0f646 33 msg.pressure = pressure;
O_Thom 6:b7f6e0c0f646 34 msg.ldr = LDR;
O_Thom 6:b7f6e0c0f646 35 return msg;
O_Thom 0:f9a18207d99c 36 }
O_Thom 6:b7f6e0c0f646 37
O_Thom 6:b7f6e0c0f646 38 void updateTimeData();
O_Thom 6:b7f6e0c0f646 39
O_Thom 5:f87129ac8bf3 40 Sampler() //Constructor
O_Thom 6:b7f6e0c0f646 41 {
O_Thom 4:740cba3f2716 42 }
O_Thom 5:f87129ac8bf3 43 ~Sampler() //Destructor - should the instance go out of scope, this is called
O_Thom 0:f9a18207d99c 44 {
O_Thom 0:f9a18207d99c 45 }
O_Thom 5:f87129ac8bf3 46 };
O_Thom 5:f87129ac8bf3 47 #endif