final
Dependencies: Encoder HIDScope MODSERIAL TouchButton mbed-dsp mbed
Fork of Robot1_11 by
Diff: main.cpp
- Revision:
- 41:f2478822cee9
- Parent:
- 40:207eb8ab507a
- Child:
- 42:8e47aeb8c206
--- a/main.cpp Sun Nov 02 12:55:26 2014 +0000 +++ b/main.cpp Sun Nov 02 12:59:40 2014 +0000 @@ -721,39 +721,23 @@ if (snelheidsstand != 0 && stop == 0) { toestand = SLAAN; pc.printf("slaan \n"); - if ( snelheidsstand==3) { - setspeed = V3; - pc.printf("Snel 3 \n"); - } - if ( snelheidsstand==2) { - setspeed = V2; - pc.printf("Snel 2\n"); - } - if ( snelheidsstand==1) { - setspeed = V1; - pc.printf("Snel 1 \n"); - } + switch(snelheidsstand) { + case 1: + setspeed = V1; + pc.printf("Snel 1 \n"); + break; + case 2: + setspeed = V2; + pc.printf("Snel 2\n"); + break; + case 3: + setspeed = V3; + pc.printf("Snel 3 \n"); + break; + }//end switch } //end if break; - - /*if (snelheidsstand != 0 && toestand == WACHTEN && stop == 0) { // stop = 0 in het begin let op dat dit na reset nog zo is - toestand = SLAAN; - pc.printf("slaan \n"); - if ( snelheidsstand==3) { - setspeed = V3; - pc.printf("Snel 3 \n"); - } - if ( snelheidsstand==2) { - setspeed = V2; - pc.printf("Snel 2\n"); - } - if ( snelheidsstand==1) { - setspeed = V1; - pc.printf("Snel 1 \n"); - } - }*/ - - } //eind van switch + } //end switch scope.set(0,motor1.getPosition()); scope.set(1,motor1.getPosition()); scope.send();