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 19:08:17 2018 +0000
Revision:
7:8664a45f5ce1
Parent:
6:b7f6e0c0f646
Child:
9:f5eae5211225
Simple serial tested -> Working Correctly.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
O_Thom 5:f87129ac8bf3 1 #include "mbed.h"
O_Thom 0:f9a18207d99c 2 #include "sample_hardware.hpp"
O_Thom 0:f9a18207d99c 3 #include "Sampler.hpp"
O_Thom 6:b7f6e0c0f646 4
O_Thom 6:b7f6e0c0f646 5 void LCD_Thread(void);
O_Thom 6:b7f6e0c0f646 6 void SAMP_Thread(void);
O_Thom 6:b7f6e0c0f646 7 void SERIAL_Thread(void);
O_Thom 6:b7f6e0c0f646 8
O_Thom 6:b7f6e0c0f646 9 Thread tLCD, tSAMP, tSERIAL, tSD;
O_Thom 5:f87129ac8bf3 10
O_Thom 6:b7f6e0c0f646 11 // Define member object
O_Thom 7:8664a45f5ce1 12 Sampler m_oSample;
O_Thom 5:f87129ac8bf3 13
O_Thom 6:b7f6e0c0f646 14 int main()
O_Thom 6:b7f6e0c0f646 15 {
O_Thom 6:b7f6e0c0f646 16 tLCD.start(LCD_Thread);
O_Thom 6:b7f6e0c0f646 17 tSAMP.start(SAMP_Thread);
O_Thom 6:b7f6e0c0f646 18 tSERIAL.start(SERIAL_Thread);
O_Thom 6:b7f6e0c0f646 19 Thread::wait(osWaitForever);
O_Thom 6:b7f6e0c0f646 20 }
O_Thom 0:f9a18207d99c 21
O_Thom 0:f9a18207d99c 22
O_Thom 6:b7f6e0c0f646 23 void LCD_Thread()
O_Thom 6:b7f6e0c0f646 24 {
O_Thom 6:b7f6e0c0f646 25 while(1)
O_Thom 6:b7f6e0c0f646 26 {
O_Thom 6:b7f6e0c0f646 27 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
O_Thom 6:b7f6e0c0f646 28 m_oDisplay.LCD_Queue.dispatch(); //dispatches the above tasks to the queue, then blocks main forever unless ' break_dispatch () ' is used
O_Thom 6:b7f6e0c0f646 29 while(true)
O_Thom 6:b7f6e0c0f646 30 {
O_Thom 6:b7f6e0c0f646 31 redLED = 1;
O_Thom 6:b7f6e0c0f646 32 wait(0.5);
O_Thom 6:b7f6e0c0f646 33 redLED = 0;
O_Thom 6:b7f6e0c0f646 34 wait(0.1);
O_Thom 6:b7f6e0c0f646 35 }
O_Thom 6:b7f6e0c0f646 36 }
O_Thom 6:b7f6e0c0f646 37 }
O_Thom 0:f9a18207d99c 38
O_Thom 6:b7f6e0c0f646 39 void SAMP_Thread()
O_Thom 6:b7f6e0c0f646 40 {
O_Thom 6:b7f6e0c0f646 41 while(1)
O_Thom 6:b7f6e0c0f646 42 {
O_Thom 7:8664a45f5ce1 43 m_oSample.SAMP_Queue.call_every(500, &m_oSample, &Sampler::publishSample); // Publish sample
O_Thom 7:8664a45f5ce1 44 m_oSample.SAMP_Queue.dispatch();
O_Thom 6:b7f6e0c0f646 45 while(true)
O_Thom 6:b7f6e0c0f646 46 { // Flash if the event queue is exited.
O_Thom 6:b7f6e0c0f646 47 yellowLED = 1;
O_Thom 6:b7f6e0c0f646 48 wait(0.5);
O_Thom 6:b7f6e0c0f646 49 yellowLED = 0;
O_Thom 6:b7f6e0c0f646 50 wait(0.1);
O_Thom 6:b7f6e0c0f646 51 }
O_Thom 6:b7f6e0c0f646 52 }
O_Thom 6:b7f6e0c0f646 53 }
O_Thom 6:b7f6e0c0f646 54
O_Thom 6:b7f6e0c0f646 55 void SERIAL_Thread()
O_Thom 0:f9a18207d99c 56 {
O_Thom 6:b7f6e0c0f646 57 while(1)
O_Thom 6:b7f6e0c0f646 58 {
O_Thom 7:8664a45f5ce1 59 m_oSerial.SERIAL_Queue.call_every(1000, &m_oSerial, &Serialcomms::updateTerminal); // Publish sample
O_Thom 7:8664a45f5ce1 60 m_oSerial.SERIAL_Queue.dispatch();
O_Thom 6:b7f6e0c0f646 61 while(true)
O_Thom 6:b7f6e0c0f646 62 { // Flash if the event queue is exited.
O_Thom 6:b7f6e0c0f646 63 yellowLED = 1;
O_Thom 6:b7f6e0c0f646 64 wait(0.5);
O_Thom 6:b7f6e0c0f646 65 yellowLED = 0;
O_Thom 6:b7f6e0c0f646 66 wait(0.1);
O_Thom 6:b7f6e0c0f646 67 }
O_Thom 6:b7f6e0c0f646 68 }
O_Thom 0:f9a18207d99c 69 }
O_Thom 6:b7f6e0c0f646 70