Simple test program to get familiar with functionality of MBED RTOS on ST Nucleo-F411RE. Tasks for LED blinking, user button, temperature measurement with DS1620, temperature measurement with internal temperature sensor of ST32F411RE, ultrasonic distance measurement and displaying result on 16x2 TextLCD.
Dependencies: DS1620_improved TextLCD_improved mbed-rtos mbed
tsk_led.cpp@11:e89f89c0920b, 2015-12-14 (annotated)
- Committer:
- dzoni
- Date:
- Mon Dec 14 17:15:29 2015 +0000
- Revision:
- 11:e89f89c0920b
- Parent:
- 9:645f0e517017
- Child:
- 17:94c385ff2641
Compiles OK, ready for testing.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dzoni | 9:645f0e517017 | 1 | #include "mbed.h" |
dzoni | 9:645f0e517017 | 2 | #include "rtos.h" |
dzoni | 9:645f0e517017 | 3 | |
dzoni | 9:645f0e517017 | 4 | #include "tsk_led.h" |
dzoni | 9:645f0e517017 | 5 | |
dzoni | 9:645f0e517017 | 6 | |
dzoni | 9:645f0e517017 | 7 | struct led_flash_times_struct led_flash_times = { 100, 2500 }; |
dzoni | 9:645f0e517017 | 8 | |
dzoni | 9:645f0e517017 | 9 | |
dzoni | 9:645f0e517017 | 10 | static DigitalOut led2(LED2); |
dzoni | 9:645f0e517017 | 11 | |
dzoni | 9:645f0e517017 | 12 | |
dzoni | 11:e89f89c0920b | 13 | void led_thread(void const *args) { |
dzoni | 9:645f0e517017 | 14 | |
dzoni | 9:645f0e517017 | 15 | while (true) { |
dzoni | 9:645f0e517017 | 16 | led2 = 1; |
dzoni | 9:645f0e517017 | 17 | Thread::wait(led_flash_times.on_time); |
dzoni | 9:645f0e517017 | 18 | |
dzoni | 9:645f0e517017 | 19 | led2 = 0; |
dzoni | 9:645f0e517017 | 20 | Thread::wait(led_flash_times.off_time); |
dzoni | 9:645f0e517017 | 21 | } |
dzoni | 9:645f0e517017 | 22 | } |