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
LCD.cpp@5:f87129ac8bf3, 2018-11-29 (annotated)
- Committer:
- O_Thom
- Date:
- Thu Nov 29 16:08:28 2018 +0000
- Revision:
- 5:f87129ac8bf3
Commit before change from sample message class to typedef struct
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| O_Thom | 5:f87129ac8bf3 | 1 | #include "mbed.h" |
| O_Thom | 5:f87129ac8bf3 | 2 | #include "sample_hardware.hpp" |
| O_Thom | 5:f87129ac8bf3 | 3 | #include "LCD.hpp" |
| O_Thom | 5:f87129ac8bf3 | 4 | |
| O_Thom | 5:f87129ac8bf3 | 5 | //EventQueue LCD_Queue; //create an event queue for main |
| O_Thom | 5:f87129ac8bf3 | 6 | Ticker read_Data; //used to read the sensor data information every 5 seconds from mail queue |
| O_Thom | 5:f87129ac8bf3 | 7 | |
| O_Thom | 5:f87129ac8bf3 | 8 | void LCD_Thread() |
| O_Thom | 5:f87129ac8bf3 | 9 | { |
| O_Thom | 5:f87129ac8bf3 | 10 | while(1) |
| O_Thom | 5:f87129ac8bf3 | 11 | { |
| O_Thom | 5:f87129ac8bf3 | 12 | 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 | 5:f87129ac8bf3 | 13 | m_oDisplay.LCD_Queue.call_every(5000, &m_oDisplay, &LCD_Data::update_sensor_info); //reads sensor information every X miliseconds |
| O_Thom | 5:f87129ac8bf3 | 14 | m_oDisplay.LCD_Queue.dispatch(); //dispatches the above tasks to the queue, then blocks main forever unless ' break_dispatch () ' is used |
| O_Thom | 5:f87129ac8bf3 | 15 | while(true) { |
| O_Thom | 5:f87129ac8bf3 | 16 | redLED = 1; |
| O_Thom | 5:f87129ac8bf3 | 17 | wait(0.5); |
| O_Thom | 5:f87129ac8bf3 | 18 | redLED = 0; |
| O_Thom | 5:f87129ac8bf3 | 19 | wait(0.1); |
| O_Thom | 5:f87129ac8bf3 | 20 | } |
| O_Thom | 5:f87129ac8bf3 | 21 | } |
| O_Thom | 5:f87129ac8bf3 | 22 | } |