![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
PROJ515-MASTER-No-PWM
Dependencies: mbed mbed-rtos ShiftReg2 TextLCD
main.cpp@1:241551e24735, 2019-03-30 (annotated)
- Committer:
- mwthewsey
- Date:
- Sat Mar 30 13:00:13 2019 +0000
- Revision:
- 1:241551e24735
- Parent:
- 0:c63c0359492d
- Child:
- 2:4c18a6d89f19
Blue Pill test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mwthewsey | 0:c63c0359492d | 1 | #include "mbed.h" |
mwthewsey | 0:c63c0359492d | 2 | #include "rtos.h" //Real Time Operating System. https://os.mbed.com/handbook/RTOS |
mwthewsey | 0:c63c0359492d | 3 | |
mwthewsey | 1:241551e24735 | 4 | //DigitalOut myled(LED1); |
mwthewsey | 1:241551e24735 | 5 | DigitalOut myled(PC_13); |
mwthewsey | 1:241551e24735 | 6 | //DigitalOut myled2(LED2); |
mwthewsey | 0:c63c0359492d | 7 | Thread thread; |
mwthewsey | 0:c63c0359492d | 8 | |
mwthewsey | 1:241551e24735 | 9 | /* |
mwthewsey | 0:c63c0359492d | 10 | void led2_thread() { |
mwthewsey | 0:c63c0359492d | 11 | while(true){ |
mwthewsey | 0:c63c0359492d | 12 | myled2 = !myled2; |
mwthewsey | 0:c63c0359492d | 13 | Thread::wait(1000); |
mwthewsey | 0:c63c0359492d | 14 | } |
mwthewsey | 0:c63c0359492d | 15 | } |
mwthewsey | 1:241551e24735 | 16 | */ |
mwthewsey | 0:c63c0359492d | 17 | |
mwthewsey | 0:c63c0359492d | 18 | int main() { |
mwthewsey | 1:241551e24735 | 19 | // thread.start(led2_thread); |
mwthewsey | 0:c63c0359492d | 20 | while(1) { |
mwthewsey | 0:c63c0359492d | 21 | myled = 1; // LED is ON |
mwthewsey | 1:241551e24735 | 22 | wait(1); // 200 ms |
mwthewsey | 0:c63c0359492d | 23 | myled = 0; // LED is OFF |
mwthewsey | 1:241551e24735 | 24 | wait(1); // 1 sec |
mwthewsey | 0:c63c0359492d | 25 | } |
mwthewsey | 0:c63c0359492d | 26 | } |