Eser 1
Dependencies: mbed
main.cpp@0:db13d12d2b12, 2016-10-03 (annotated)
- Committer:
- gianfalanga
- Date:
- Mon Oct 03 18:42:13 2016 +0000
- Revision:
- 0:db13d12d2b12
Esercitazione 1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gianfalanga | 0:db13d12d2b12 | 1 | #include "mbed.h" |
gianfalanga | 0:db13d12d2b12 | 2 | |
gianfalanga | 0:db13d12d2b12 | 3 | |
gianfalanga | 0:db13d12d2b12 | 4 | |
gianfalanga | 0:db13d12d2b12 | 5 | DigitalOut myled(LED1); |
gianfalanga | 0:db13d12d2b12 | 6 | DigitalOut myled2(D8); |
gianfalanga | 0:db13d12d2b12 | 7 | DigitalIn b1(PC_13); |
gianfalanga | 0:db13d12d2b12 | 8 | |
gianfalanga | 0:db13d12d2b12 | 9 | int main() { |
gianfalanga | 0:db13d12d2b12 | 10 | while (1){ |
gianfalanga | 0:db13d12d2b12 | 11 | if(b1==1){ |
gianfalanga | 0:db13d12d2b12 | 12 | myled=1; |
gianfalanga | 0:db13d12d2b12 | 13 | wait(0.02); |
gianfalanga | 0:db13d12d2b12 | 14 | myled=0; |
gianfalanga | 0:db13d12d2b12 | 15 | wait(0.02);} |
gianfalanga | 0:db13d12d2b12 | 16 | else{ |
gianfalanga | 0:db13d12d2b12 | 17 | myled=1; |
gianfalanga | 0:db13d12d2b12 | 18 | wait(0.04); |
gianfalanga | 0:db13d12d2b12 | 19 | myled=0; |
gianfalanga | 0:db13d12d2b12 | 20 | wait(0.04);} |
gianfalanga | 0:db13d12d2b12 | 21 | } |
gianfalanga | 0:db13d12d2b12 | 22 | } |