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: mbed
main.cpp@5:3121f8550958, 2019-01-09 (annotated)
- Committer:
- odb
- Date:
- Wed Jan 09 04:19:39 2019 +0000
- Revision:
- 5:3121f8550958
- Parent:
- 4:da46bcd42799
LED
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| screamer | 0:005629fe3609 | 1 | #include "mbed.h" |
| screamer | 0:005629fe3609 | 2 | |
| odb | 5:3121f8550958 | 3 | DigitalOut mybuzzer(PC_4); |
| odb | 5:3121f8550958 | 4 | PwmOut mypwmR(PB_5); |
| odb | 5:3121f8550958 | 5 | PwmOut mypwmG(PB_3); |
| odb | 5:3121f8550958 | 6 | PwmOut mypwmB(PA_10); |
| odb | 5:3121f8550958 | 7 | BusOut motor(PB_13, PB_14, PB_15, PB_1); |
| odb | 5:3121f8550958 | 8 | DigitalOut myled[4] = { PC_9, PB_2, PC_2, PC_3}; |
| odb | 5:3121f8550958 | 9 | DigitalIn mysw[4] = {PC_10,PC_11, PC_12, PA_13 }; |
| screamer | 0:005629fe3609 | 10 | int main() { |
| odb | 5:3121f8550958 | 11 | int i; |
| screamer | 0:005629fe3609 | 12 | while(1) { |
| odb | 5:3121f8550958 | 13 | /* |
| odb | 5:3121f8550958 | 14 | for (i= 0; i< 4 ;i++) |
| odb | 5:3121f8550958 | 15 | { |
| odb | 5:3121f8550958 | 16 | myled[i] = 1; // LED is ON |
| odb | 5:3121f8550958 | 17 | mybuzzer = 1; |
| odb | 5:3121f8550958 | 18 | wait(0.5); // 200 ms |
| odb | 5:3121f8550958 | 19 | myled[i] = 0; // LED is OFF |
| odb | 5:3121f8550958 | 20 | mybuzzer = 0; |
| odb | 5:3121f8550958 | 21 | wait(0.5); // 1 sec |
| odb | 5:3121f8550958 | 22 | } |
| odb | 5:3121f8550958 | 23 | */ |
| odb | 5:3121f8550958 | 24 | for( i = 0; i < 4 ; i++) |
| odb | 5:3121f8550958 | 25 | { |
| odb | 5:3121f8550958 | 26 | if(!(mysw[i])) |
| odb | 5:3121f8550958 | 27 | { |
| odb | 5:3121f8550958 | 28 | myled[i] = 1; |
| odb | 5:3121f8550958 | 29 | wait(1); |
| odb | 5:3121f8550958 | 30 | } |
| odb | 5:3121f8550958 | 31 | else myled[i] = 0; |
| odb | 5:3121f8550958 | 32 | } |
| screamer | 0:005629fe3609 | 33 | } |
| screamer | 0:005629fe3609 | 34 | } |