a template project as bare mental on L4R5ZI
main.cpp@0:bcb987508904, 2020-10-27 (annotated)
- Committer:
- lixf
- Date:
- Tue Oct 27 08:59:19 2020 +0000
- Revision:
- 0:bcb987508904
a template project as bare mental on L4R5ZI
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lixf | 0:bcb987508904 | 1 | #include "mbed.h" |
lixf | 0:bcb987508904 | 2 | |
lixf | 0:bcb987508904 | 3 | #define WAIT_TIME_MS 1000 |
lixf | 0:bcb987508904 | 4 | DigitalOut led1(LED1); |
lixf | 0:bcb987508904 | 5 | DigitalOut led2(LED2); |
lixf | 0:bcb987508904 | 6 | DigitalOut led3(LED3); |
lixf | 0:bcb987508904 | 7 | |
lixf | 0:bcb987508904 | 8 | int main() |
lixf | 0:bcb987508904 | 9 | { |
lixf | 0:bcb987508904 | 10 | int i = 0; |
lixf | 0:bcb987508904 | 11 | printf("Bare metal code on Mbed OS %d.%d.%d.\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION); |
lixf | 0:bcb987508904 | 12 | |
lixf | 0:bcb987508904 | 13 | for( i=0; i<20; i++) { |
lixf | 0:bcb987508904 | 14 | led1 = led2 = led3 = 1; |
lixf | 0:bcb987508904 | 15 | thread_sleep_for(100); |
lixf | 0:bcb987508904 | 16 | led1 = led2 = led3 = 0; |
lixf | 0:bcb987508904 | 17 | thread_sleep_for(100); |
lixf | 0:bcb987508904 | 18 | } |
lixf | 0:bcb987508904 | 19 | |
lixf | 0:bcb987508904 | 20 | i = 0; |
lixf | 0:bcb987508904 | 21 | |
lixf | 0:bcb987508904 | 22 | while (true) |
lixf | 0:bcb987508904 | 23 | { |
lixf | 0:bcb987508904 | 24 | led1 = !led1; |
lixf | 0:bcb987508904 | 25 | led2 = !led1; |
lixf | 0:bcb987508904 | 26 | led3 = !led2; |
lixf | 0:bcb987508904 | 27 | i++; |
lixf | 0:bcb987508904 | 28 | printf("Time: %d\n", i); |
lixf | 0:bcb987508904 | 29 | thread_sleep_for(WAIT_TIME_MS); |
lixf | 0:bcb987508904 | 30 | } |
lixf | 0:bcb987508904 | 31 | } |