test
Dependencies: mbed KondoServoLibrary Encoder
Revision 21:0f12ee2322e4, committed 2020-03-12
- Comitter:
- koheim
- Date:
- Thu Mar 12 07:32:03 2020 +0000
- Parent:
- 20:dd4634500bb3
- Commit message:
- a;
Changed in this revision
User.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r dd4634500bb3 -r 0f12ee2322e4 User.cpp --- a/User.cpp Thu Mar 12 03:04:51 2020 +0000 +++ b/User.cpp Thu Mar 12 07:32:03 2020 +0000 @@ -14,29 +14,34 @@ //Digitalout cs(p8); int move=5,shoot=0,ball=0,box=0; CAN controller(p30,p29);//CANpin_name + DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led3(LED3); DigitalOut led4(LED4); char can[1]= {0}; + KondoServo servo(p28,p27);//サーボ -int out = 1; // shot - PwmOut f(p26);//投F PwmOut b(p25);//投B + Ticker ticker; + Ec1multi EC(p16,p17,RESOLUTION);//投E InterruptIn X(p15); + DigitalOut out1(p19);//エアシリンダー(つかむ方) DigitalOut out2(p20);//エアシリンダー(投擲) - +DigitalOut out3(p18);//エアシリンダー(ボックス) int id = 0; +int id2 = 1; double SERVO2DEG = 270.0 / (11500 - 3500); double first = (6800 - 3500) * SERVO2DEG; double grab = (3600 - 3500) * SERVO2DEG; double pass = (5000 - 3500) * SERVO2DEG; +double grab2 = (3550 - 3500) * SERVO2DEG; void cal() { @@ -239,10 +244,7 @@ } break; case 3: - f=0.01; - wait (0.1); - f=0; - shoot = 0; + servo.set_degree(id2, grab2); break; case 4: if (out1==0) { @@ -254,14 +256,11 @@ } break; case 5: - if (out2==0) { - out2=1; - shoot=0; - } else if (out2 == 1) { - out2=0; - shoot=0; + if (out3==0) { + out3=1; + } else if (out3 == 1) { + out3=0; } - } }