Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed WattBob_TextLCD
Diff: main.cpp
- Revision:
- 2:0d0ec8aa4605
- Parent:
- 1:05b399616fcd
- Child:
- 3:0ce1c635a653
diff -r 05b399616fcd -r 0d0ec8aa4605 main.cpp --- a/main.cpp Thu Nov 24 12:10:17 2011 +0000 +++ b/main.cpp Thu Nov 24 16:04:06 2011 +0000 @@ -252,11 +252,15 @@ led4 = 0; counter1p.read(); counter2p.read(); - if(counter1p > 0.5){ - state = 1; + if(SW1p == 0){ + if(counter1p > 0.5){ + state = 1; + } } - if(counter2p > 0.5){ - state = 4; + if(SW2p == 0){ + if(counter2p > 0.5){ + state = 4; + } } break; case 1: // state 1 if counter1p = 1 @@ -265,12 +269,13 @@ wait(1); Position1_1p = 0; Position2_1p = 1; - if(Position2_1p == 1){ + if((Position2_1p == 1)&&(counter1p < 0.5)){ state = 2; } break; case 2: // state 2 if servo 1p is in position 2 servo_4.pulsewidth_us(1000 + (25 * 1000) / 90); // motor is run + counter1p.read(); if(counter1p > 0.5){ state = 3; } @@ -303,7 +308,7 @@ servo_4.pulsewidth_us(0); // motor stop led4 = 1; if(SW2p == 1){ // wait SW 2p to go to the initial state - state = 0; + state = 0; } break; }