encoder verwerkt
Dependencies: MODSERIAL QEI mbed
Fork of motor_control by
main.cpp@0:8ed7e7bbc391, 2016-09-26 (annotated)
- Committer:
- FloorC
- Date:
- Mon Sep 26 13:40:12 2016 +0000
- Revision:
- 0:8ed7e7bbc391
- Child:
- 1:e415c6eda278
Motor control test with LEDs
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
FloorC | 0:8ed7e7bbc391 | 1 | #include "mbed.h" |
FloorC | 0:8ed7e7bbc391 | 2 | |
FloorC | 0:8ed7e7bbc391 | 3 | DigitalIn switch2(SW2); |
FloorC | 0:8ed7e7bbc391 | 4 | DititalIn switch3(SW3); |
FloorC | 0:8ed7e7bbc391 | 5 | DigitalOut groen(LED_GREEN); |
FloorC | 0:8ed7e7bbc391 | 6 | DigitalOut rood(LED_RED); |
FloorC | 0:8ed7e7bbc391 | 7 | Serial pc(USBTX, USBRX); |
FloorC | 0:8ed7e7bbc391 | 8 | |
FloorC | 0:8ed7e7bbc391 | 9 | int main() |
FloorC | 0:8ed7e7bbc391 | 10 | { |
FloorC | 0:8ed7e7bbc391 | 11 | groen = 1; |
FloorC | 0:8ed7e7bbc391 | 12 | rood = 1; |
FloorC | 0:8ed7e7bbc391 | 13 | |
FloorC | 0:8ed7e7bbc391 | 14 | while (true){ |
FloorC | 0:8ed7e7bbc391 | 15 | |
FloorC | 0:8ed7e7bbc391 | 16 | if (SW2 == 0){ |
FloorC | 0:8ed7e7bbc391 | 17 | groen = 0; |
FloorC | 0:8ed7e7bbc391 | 18 | rood = 1; |
FloorC | 0:8ed7e7bbc391 | 19 | } |
FloorC | 0:8ed7e7bbc391 | 20 | else if (SW3 == 0){ |
FloorC | 0:8ed7e7bbc391 | 21 | groen = 1; |
FloorC | 0:8ed7e7bbc391 | 22 | rood = 0; |
FloorC | 0:8ed7e7bbc391 | 23 | } |
FloorC | 0:8ed7e7bbc391 | 24 | else{ |
FloorC | 0:8ed7e7bbc391 | 25 | groen = 1; |
FloorC | 0:8ed7e7bbc391 | 26 | rood = 1; |
FloorC | 0:8ed7e7bbc391 | 27 | } |
FloorC | 0:8ed7e7bbc391 | 28 | } |
FloorC | 0:8ed7e7bbc391 | 29 | } |
FloorC | 0:8ed7e7bbc391 | 30 |