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
Revision 3:0ce1c635a653, committed 2011-11-24
- Comitter:
- Nurbol
- Date:
- Thu Nov 24 16:15:02 2011 +0000
- Parent:
- 2:0d0ec8aa4605
- Commit message:
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Nov 24 16:04:06 2011 +0000 +++ b/main.cpp Thu Nov 24 16:15:02 2011 +0000 @@ -236,7 +236,7 @@ } - +//function for the state machine to move servos between 2 positions void state_machine (){ switch(state) { @@ -315,91 +315,6 @@ } -//function to move servo when we have counter1p equal to 10 -/* -void counter1 (){ - if((counter1p > 0.5)&&(Position1_1p == 1)&&(SW1p == 0)){ - led3 = 1; - servo_4.pulsewidth_us(0); - wait(1); - servo_0.pulsewidth_us(1000 + (200 * 1000) / 90); - wait(1); - if(SW1p == 1){ - Position2_1p = 1; - Position1_1p = 0; - } - } - else if ((counter1p > 0.5)&&(Position2_1p == 1)&&(SW1p == 0)){ - led3 = 1; - servo_4.pulsewidth_us(0); - wait(1); - servo_0.pulsewidth_us(1000 + (0 * 1000) / 90); - wait(1); - if(SW1p == 1){ - Position2_1p = 0; - Position1_1p = 1; - } - } - else if ((counter1p < 0.5)&&(Position1_1p == 1)&&(SW1p == 0)){ - led3 = 0; - servo_0.pulsewidth_us(1000 + (0 * 1000) / 90); - if(counter2p < 0.5){ - servo_4.pulsewidth_us(1000 + (25 * 1000) / 90); - } - } - else if ((counter1p < 0.5)&&(Position2_1p == 1)&&(SW1p == 0)){ - led3 = 0; - servo_0.pulsewidth_us(1000 + (200 * 1000) / 90); - if(counter2p < 0.5){ - servo_4.pulsewidth_us(1000 + (25 * 1000) / 90); - } - } -} -*/ -//function to move servo when we have counter2p equal to 5 - -/*void counter2(){ - if((counter2p > 0.5)&&(Position1_1p == 1)&&(SW2p == 0)){ - led3 = 1; - servo_4.pulsewidth_us(0); - wait(1); - servo_5.pulsewidth_us(1000 + (200 * 1000) / 90); - wait(1); - if(SW2p == 1){ - Position2_1p = 1; - Position1_1p = 0; - } - } - else if ((counter2p > 0.5)&&(Position2_1p == 1)&&(SW2p == 0)){ - led3 = 1; - servo_4.pulsewidth_us(0); - wait(1); - servo_5.pulsewidth_us(1000 + (0 * 1000) / 90); - wait(1); - if(SW2p == 1){ - Position2_1p = 0; - Position1_1p = 1; - } - } - else if ((counter2p < 0.5)&&(Position1_1p == 1)&&(SW2p == 0)){ - led3 = 0; - servo_5.pulsewidth_us(1000 + (0 * 1000) / 90); - if(counter1p < 0.5){ - servo_4.pulsewidth_us(1000 + (25 * 1000) / 90); - } - } - else if ((counter2p < 0.5)&&(Position2_1p == 1)&&(SW2p == 0)){ - led3 = 0; - servo_5.pulsewidth_us(1000 + (200 * 1000) / 90); - if(counter1p < 0.5){ - servo_4.pulsewidth_us(1000 + (25 * 1000) / 90); - } - } -} - -*/ - - //************************************************************************ // int main() { @@ -419,14 +334,7 @@ timerstatemachine.attach(&state_machine, 0.1); -//state_machine - -//end of the state machine - - -// timercounter2p.attach(&counter2, 0.1); //function counter2 is reading all the 0.1 ms -// timercounter1p.attach(&counter1, 0.1); //function counter1 is reading all the 0.1 ms - + clk = !clk; wait(0.01);