g
Dependencies: MODSERIAL mbed Encoder
begintotaalscript.cpp@0:e9e50c0a6502, 2013-10-31 (annotated)
- Committer:
- Esther
- Date:
- Thu Oct 31 14:10:59 2013 +0000
- Revision:
- 0:e9e50c0a6502
- Child:
- 1:8a0a39740897
begin
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Esther | 0:e9e50c0a6502 | 1 | #include "mbed.h" |
Esther | 0:e9e50c0a6502 | 2 | #include "MODSERIAL.h" |
Esther | 0:e9e50c0a6502 | 3 | |
Esther | 0:e9e50c0a6502 | 4 | |
Esther | 0:e9e50c0a6502 | 5 | int main() |
Esther | 0:e9e50c0a6502 | 6 | { |
Esther | 0:e9e50c0a6502 | 7 | |
Esther | 0:e9e50c0a6502 | 8 | MODSERIAL pc(USBTX,USBRX,64,1024); |
Esther | 0:e9e50c0a6502 | 9 | pc.baud(115200); |
Esther | 0:e9e50c0a6502 | 10 | |
Esther | 0:e9e50c0a6502 | 11 | |
Esther | 0:e9e50c0a6502 | 12 | DigitalIn knop1(PTC2); |
Esther | 0:e9e50c0a6502 | 13 | DigitalIn knop2(PTB3); |
Esther | 0:e9e50c0a6502 | 14 | DigitalIn knop3(PTB2); |
Esther | 0:e9e50c0a6502 | 15 | |
Esther | 0:e9e50c0a6502 | 16 | knop1.mode(PullUp); |
Esther | 0:e9e50c0a6502 | 17 | knop2.mode(PullUp); |
Esther | 0:e9e50c0a6502 | 18 | knop3.mode(PullUp); |
Esther | 0:e9e50c0a6502 | 19 | |
Esther | 0:e9e50c0a6502 | 20 | int state = 1; |
Esther | 0:e9e50c0a6502 | 21 | |
Esther | 0:e9e50c0a6502 | 22 | while (true) { |
Esther | 0:e9e50c0a6502 | 23 | |
Esther | 0:e9e50c0a6502 | 24 | if (state == 1) |
Esther | 0:e9e50c0a6502 | 25 | pc.printf("state 1 rust| 1=cal motor 2=cal emg 3=tekenen /n/r"); |
Esther | 0:e9e50c0a6502 | 26 | |
Esther | 0:e9e50c0a6502 | 27 | if (knop1 == false ) { |
Esther | 0:e9e50c0a6502 | 28 | state=2; |
Esther | 0:e9e50c0a6502 | 29 | wait(0.05); |
Esther | 0:e9e50c0a6502 | 30 | } |
Esther | 0:e9e50c0a6502 | 31 | |
Esther | 0:e9e50c0a6502 | 32 | if (knop2 == false ) { |
Esther | 0:e9e50c0a6502 | 33 | state=3; |
Esther | 0:e9e50c0a6502 | 34 | wait(0.05); |
Esther | 0:e9e50c0a6502 | 35 | } |
Esther | 0:e9e50c0a6502 | 36 | if (knop3 == false ) { |
Esther | 0:e9e50c0a6502 | 37 | state=6; |
Esther | 0:e9e50c0a6502 | 38 | wait(0.05); |
Esther | 0:e9e50c0a6502 | 39 | } |
Esther | 0:e9e50c0a6502 | 40 | |
Esther | 0:e9e50c0a6502 | 41 | |
Esther | 0:e9e50c0a6502 | 42 | |
Esther | 0:e9e50c0a6502 | 43 | |
Esther | 0:e9e50c0a6502 | 44 | if (state == 2) |
Esther | 0:e9e50c0a6502 | 45 | pc.printf("state 2 cal robot| 2= rust /n/r"); |
Esther | 0:e9e50c0a6502 | 46 | if (state == 3) |
Esther | 0:e9e50c0a6502 | 47 | pc.printf("state 3 cal EMG | 1=cal emg laag 3=cal emg hoog /n/r"); |
Esther | 0:e9e50c0a6502 | 48 | //if (state == 4) |
Esther | 0:e9e50c0a6502 | 49 | // pc.printf("state 1 | 1=cal motor 2=cal emg 3=tekenen /n/r"); |
Esther | 0:e9e50c0a6502 | 50 | //if (state == 5) |
Esther | 0:e9e50c0a6502 | 51 | // pc.printf("state 1 | 1=cal motor 2=cal emg 3=tekenen /n/r"); |
Esther | 0:e9e50c0a6502 | 52 | if (state == 6) |
Esther | 0:e9e50c0a6502 | 53 | pc.printf("state 6 tekenen| 6=rust /n/r"); |
Esther | 0:e9e50c0a6502 | 54 | |
Esther | 0:e9e50c0a6502 | 55 | } //sluiten oneindige while loop |
Esther | 0:e9e50c0a6502 | 56 | |
Esther | 0:e9e50c0a6502 | 57 | }//afsluiten main |