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.
Revision 13:678870d8f851, committed 2019-05-15
- Comitter:
- yuto17320508
- Date:
- Wed May 15 10:19:13 2019 +0000
- Parent:
- 12:e6fd3a3201f0
- Commit message:
- l
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed May 15 06:49:13 2019 +0000 +++ b/main.cpp Wed May 15 10:19:13 2019 +0000 @@ -72,30 +72,30 @@ bus_out = 1; printf("start\n\r"); int mode = -1; - air_hand = 1; + air_hand = 0; while(1) { float duty = 0.0; can_receive(mode,duty); + bus_out = 0;//未収束 printf("mode:%d duty:%.3f\n\r", mode, duty); motor_ro.setDutyLimit(duty); motor_ri.setDutyLimit(duty); - if(hand_mode == G_OPEN) { - air_hand = 1; + //printf("target is %d\n\r",target_ro); + if(mode == FORWARD) forward(); + else if(mode == STOP) stop(); + else if(mode == BACK) back(); + if(hand_mode == G_CLOSE) { + air_hand = 0; } - else if(hand_mode == G_CLOSE) { - air_hand = 0; + else if(hand_mode == G_OPEN) { + air_hand = 1; } else if(hand_mode == GOAL) { for(int i=0; i<10; ++i) servo.set_degree(0,(7200 - 3500) * 270.0/(11500 - 3500)); } - bus_out = 0; - //printf("target is %d\n\r",target_ro); - if(mode == FORWARD) forward(); - else if(mode == STOP) stop(); - else if(mode == BACK) back(); - bus_out = 1; + bus_out = 1;//収束 } } @@ -136,7 +136,7 @@ motor_ro_b.period_us(100); motor_ri_f.period_us(100); motor_ri_b.period_us(100); - air_hand = 1;//ゲレゲを離す手の形にしておく + air_hand = 0;//ゲレゲを離す手の形にしておく switch_ro.mode(PullUp); switch_ri.mode(PullUp); servo.init();