Morsecode programma opdracht 1.1
Dependencies: mbed
MorseCode.cpp@0:5a59e3e00ed6, 2018-03-10 (annotated)
- Committer:
- lennartgroen
- Date:
- Sat Mar 10 09:38:02 2018 +0000
- Revision:
- 0:5a59e3e00ed6
Eerste uitgave;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lennartgroen | 0:5a59e3e00ed6 | 1 | /* |
lennartgroen | 0:5a59e3e00ed6 | 2 | Namen: Lennart Groen |
lennartgroen | 0:5a59e3e00ed6 | 3 | Klas: EMT1PSa |
lennartgroen | 0:5a59e3e00ed6 | 4 | Opdracht: MBED - Morse code blinker |
lennartgroen | 0:5a59e3e00ed6 | 5 | Samengewerkt met: ... |
lennartgroen | 0:5a59e3e00ed6 | 6 | Datum: 10-03-2018 |
lennartgroen | 0:5a59e3e00ed6 | 7 | Inspiratie uit: |
lennartgroen | 0:5a59e3e00ed6 | 8 | */ |
lennartgroen | 0:5a59e3e00ed6 | 9 | |
lennartgroen | 0:5a59e3e00ed6 | 10 | #include "mbed.h" |
lennartgroen | 0:5a59e3e00ed6 | 11 | |
lennartgroen | 0:5a59e3e00ed6 | 12 | DigitalOut myled(LED1); |
lennartgroen | 0:5a59e3e00ed6 | 13 | |
lennartgroen | 0:5a59e3e00ed6 | 14 | void s() |
lennartgroen | 0:5a59e3e00ed6 | 15 | { |
lennartgroen | 0:5a59e3e00ed6 | 16 | for(int i = 0; i<3; i++){ |
lennartgroen | 0:5a59e3e00ed6 | 17 | myled = 1; |
lennartgroen | 0:5a59e3e00ed6 | 18 | wait(0.2); |
lennartgroen | 0:5a59e3e00ed6 | 19 | myled = 0; |
lennartgroen | 0:5a59e3e00ed6 | 20 | wait(0.2); |
lennartgroen | 0:5a59e3e00ed6 | 21 | } |
lennartgroen | 0:5a59e3e00ed6 | 22 | } |
lennartgroen | 0:5a59e3e00ed6 | 23 | |
lennartgroen | 0:5a59e3e00ed6 | 24 | void o() |
lennartgroen | 0:5a59e3e00ed6 | 25 | { |
lennartgroen | 0:5a59e3e00ed6 | 26 | for(int i = 0; i<2; i++){ |
lennartgroen | 0:5a59e3e00ed6 | 27 | myled = 1; |
lennartgroen | 0:5a59e3e00ed6 | 28 | wait(0.5); |
lennartgroen | 0:5a59e3e00ed6 | 29 | myled = 0; |
lennartgroen | 0:5a59e3e00ed6 | 30 | wait(0.5); |
lennartgroen | 0:5a59e3e00ed6 | 31 | } |
lennartgroen | 0:5a59e3e00ed6 | 32 | } |
lennartgroen | 0:5a59e3e00ed6 | 33 | |
lennartgroen | 0:5a59e3e00ed6 | 34 | int main() |
lennartgroen | 0:5a59e3e00ed6 | 35 | { |
lennartgroen | 0:5a59e3e00ed6 | 36 | while(1){ |
lennartgroen | 0:5a59e3e00ed6 | 37 | s(); |
lennartgroen | 0:5a59e3e00ed6 | 38 | o(); |
lennartgroen | 0:5a59e3e00ed6 | 39 | s(); |
lennartgroen | 0:5a59e3e00ed6 | 40 | wait(1); |
lennartgroen | 0:5a59e3e00ed6 | 41 | } |
lennartgroen | 0:5a59e3e00ed6 | 42 | } |
lennartgroen | 0:5a59e3e00ed6 | 43 | |
lennartgroen | 0:5a59e3e00ed6 | 44 | |
lennartgroen | 0:5a59e3e00ed6 | 45 |