Version 5
Dependencies: BMP280 TextLCD BME280
main.cpp
- Committer:
- O_Thom
- Date:
- 2018-11-29
- Revision:
- 7:8664a45f5ce1
- Parent:
- 6:b7f6e0c0f646
- Child:
- 9:f5eae5211225
File content as of revision 7:8664a45f5ce1:
#include "mbed.h" #include "sample_hardware.hpp" #include "Sampler.hpp" void LCD_Thread(void); void SAMP_Thread(void); void SERIAL_Thread(void); Thread tLCD, tSAMP, tSERIAL, tSD; // Define member object Sampler m_oSample; int main() { tLCD.start(LCD_Thread); tSAMP.start(SAMP_Thread); tSERIAL.start(SERIAL_Thread); Thread::wait(osWaitForever); } void LCD_Thread() { while(1) { m_oDisplay.LCD_Queue.call_every(1000, &m_oDisplay, &LCD_Data::display_LCD); //displays the current sensor information onto the LCD screen every x miliseconds m_oDisplay.LCD_Queue.dispatch(); //dispatches the above tasks to the queue, then blocks main forever unless ' break_dispatch () ' is used while(true) { redLED = 1; wait(0.5); redLED = 0; wait(0.1); } } } void SAMP_Thread() { while(1) { m_oSample.SAMP_Queue.call_every(500, &m_oSample, &Sampler::publishSample); // Publish sample m_oSample.SAMP_Queue.dispatch(); while(true) { // Flash if the event queue is exited. yellowLED = 1; wait(0.5); yellowLED = 0; wait(0.1); } } } void SERIAL_Thread() { while(1) { m_oSerial.SERIAL_Queue.call_every(1000, &m_oSerial, &Serialcomms::updateTerminal); // Publish sample m_oSerial.SERIAL_Queue.dispatch(); while(true) { // Flash if the event queue is exited. yellowLED = 1; wait(0.5); yellowLED = 0; wait(0.1); } } }