diller
Dependencies: HCSR04 mbed tsi_sensor
Fork of frdm_tsi_slider by
Revision 2:dfc1315b4b03, committed 2015-04-11
- Comitter:
- iLyngklip
- Date:
- Sat Apr 11 10:41:09 2015 +0000
- Parent:
- 1:06bd2e196518
- Commit message:
- diller;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 06bd2e196518 -r dfc1315b4b03 main.cpp --- a/main.cpp Sat Apr 11 09:51:14 2015 +0000 +++ b/main.cpp Sat Apr 11 10:41:09 2015 +0000 @@ -58,10 +58,12 @@ // Writes the left and right distance variable pc.printf("SENSOR Left: %d \n\r\v",distLeft(dLEFT)); pc.printf("SENSOR Right: %d \n\r\v",distRight(dRIGHT)); - */ + */ + char diller = BT.getc(); + BT.putc(diller); // Break out of loop if 'p' - if(BT.getc() == 'p' && pilot == true){ - pilot == false; + if(diller == 'p' && pilot == true){ + pilot = false; } //Drej til venstre for at rette op @@ -102,7 +104,8 @@ void motorControl(char input) { switch (input) { case 'w': - sideSpeed = 0; + rightSpeed = 0; + leftSpeed = 0; BT.printf("FORWARDS!"); if (frontSpeed < 0.99) { frontSpeed = frontSpeed + 0.25f; @@ -114,10 +117,12 @@ leftBackward = backSpeed; rightForward = frontSpeed; rightBackward = backSpeed; + break; case 's': - sideSpeed = 0; + rightSpeed = 0; + leftSpeed = 0; if (frontSpeed > 0.1) { frontSpeed = frontSpeed - 0.25f; } @@ -186,6 +191,8 @@ wait(0.3); grabOut = 0; break; + + case 'x': frontSpeed = 0; backSpeed = 0; @@ -200,16 +207,16 @@ heightUp = 0; heightDown = 0; break; - /* + case 'p': if(pilot == false){ pilot = true; while(1){ - selfDrive(); + selfDrive(); } } break; - */ + } } int main(void) { @@ -222,6 +229,6 @@ command = BT.getc(); BT.putc(command); - motorControl(command); + motorControl(command); } }