![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
農作物回収機構プログラム
Dependencies: mbed arrc_mbed Motor
Revision 2:c37a8b45b96f, committed 2022-03-28
- Comitter:
- m2130
- Date:
- Mon Mar 28 04:17:20 2022 +0000
- Parent:
- 1:7937f28c742d
- Commit message:
- awawawawawawwawawa
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Mar 15 08:44:02 2022 +0000 +++ b/main.cpp Mon Mar 28 04:17:20 2022 +0000 @@ -13,7 +13,7 @@ DigitalIn Limitswitch4(PB_1); //-----Constants----- -const double pwm = 0.45; +const double pwm = 0.4; //-----Sub Routines----- bool Up(int RX,int &TX); @@ -44,18 +44,19 @@ limitswitch4 = Limitswitch4.read() ? 0 : 1; printf("%d %d %d %d %d %d\n", up, down, limitswitch1, limitswitch2, limitswitch3, limitswitch4); PWM1 = pwm * ((up * limitswitch1) - (down * limitswitch3)); - PWM2 = pwm * ((up * limitswitch2) - (down * limitswitch4)); + PWM2 = pwm * ((up * limitswitch2) - (down * limitswitch4)) * 0.8; motor1.out(PWM1); motor2.out(PWM2); } } bool Up(int RX, int &TX){ - up = RX; + if(RX == 1)up = RX; return true; } bool Down(int RX, int &TX){ down = RX; + if(RX == 1)up = 0; return true; } \ No newline at end of file