Learning project for NCUT2019 ESD students
Dependencies: LCD_DISCO_F429ZI mbed mbed-rtos BSP_DISCO_F429ZI
main.cpp@12:8679b4ebe162, 2019-05-11 (annotated)
- Committer:
- andrey001207
- Date:
- Sat May 11 02:17:58 2019 +0000
- Revision:
- 12:8679b4ebe162
- Parent:
- 11:0309bef74ba8
- Child:
- 13:4752ccf82972
For NCUT 2019 CXC students
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 1:491820ee784d | 1 | #include "mbed.h" |
andrey001207 | 12:8679b4ebe162 | 2 | #include "rtos.h" |
andrey001207 | 12:8679b4ebe162 | 3 | #include "LCD_DISCO_F429ZI.h" |
andrey001207 | 12:8679b4ebe162 | 4 | |
andrey001207 | 12:8679b4ebe162 | 5 | LCD_DISCO_F429ZI lcd; |
andrey001207 | 12:8679b4ebe162 | 6 | |
emilmont | 1:491820ee784d | 7 | DigitalOut led1(LED1); |
emilmont | 1:491820ee784d | 8 | DigitalOut led2(LED2); |
andrey001207 | 12:8679b4ebe162 | 9 | Thread thread_led; |
andrey001207 | 12:8679b4ebe162 | 10 | Thread thread_lcd; |
emilmont | 1:491820ee784d | 11 | |
geky | 7:8d9919175929 | 12 | void led2_thread() { |
emilmont | 1:491820ee784d | 13 | while (true) { |
emilmont | 1:491820ee784d | 14 | led2 = !led2; |
mbed_official | 11:0309bef74ba8 | 15 | Thread::wait(1000); |
emilmont | 1:491820ee784d | 16 | } |
emilmont | 1:491820ee784d | 17 | } |
andrey001207 | 12:8679b4ebe162 | 18 | |
andrey001207 | 12:8679b4ebe162 | 19 | void lcd_thread() { |
andrey001207 | 12:8679b4ebe162 | 20 | while (true) { |
andrey001207 | 12:8679b4ebe162 | 21 | Thread::wait(500); |
andrey001207 | 12:8679b4ebe162 | 22 | lcd.DisplayStringAt(0, 35, (uint8_t *)"128228", CENTER_MODE); |
andrey001207 | 12:8679b4ebe162 | 23 | Thread::wait(500); |
andrey001207 | 12:8679b4ebe162 | 24 | lcd.DisplayStringAt(0, 35, (uint8_t *)"<NCUT>", CENTER_MODE); |
andrey001207 | 12:8679b4ebe162 | 25 | } |
andrey001207 | 12:8679b4ebe162 | 26 | } |
emilmont | 1:491820ee784d | 27 | |
emilmont | 1:491820ee784d | 28 | int main() { |
andrey001207 | 12:8679b4ebe162 | 29 | lcd.DisplayStringAt(0, 20, (uint8_t *)"Andrew", CENTER_MODE); |
andrey001207 | 12:8679b4ebe162 | 30 | thread_led.start(led2_thread); |
andrey001207 | 12:8679b4ebe162 | 31 | thread_lcd.start(lcd_thread); |
emilmont | 1:491820ee784d | 32 | |
emilmont | 1:491820ee784d | 33 | while (true) { |
emilmont | 1:491820ee784d | 34 | led1 = !led1; |
mbed_official | 11:0309bef74ba8 | 35 | Thread::wait(500); |
emilmont | 1:491820ee784d | 36 | } |
emilmont | 1:491820ee784d | 37 | } |