![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
raspai
Dependencies: mbed SBDBT arrc_mbed Servo air
Diff: main.cpp
- Revision:
- 2:1d031514e4ff
- Parent:
- 1:1766ac88bf57
diff -r 1766ac88bf57 -r 1d031514e4ff main.cpp --- a/main.cpp Fri Mar 04 02:52:44 2022 +0000 +++ b/main.cpp Fri Apr 01 02:50:57 2022 +0000 @@ -4,19 +4,19 @@ #include "scrp_slave.hpp" ScrpSlave slave(PC_12,PD_2,PH_1,SERIAL_TX,SERIAL_RX,0x0807ffff); Serial pc(SERIAL_TX,SERIAL_RX); -DigitalIn limitA(PA_9,PullUp); -Air hassya(PB_8); +DigitalIn limitA(PB_0,PullUp); +Air hassya(PB_9); DigitalOut Led1(PA_10); DigitalOut Led2(PB_15); DigitalOut Led3(PB_2); -Servo myservo(PB_6); +Servo myservo(PB_13); Timer timer; int tim=-6000; int a=0; //↓モータ用 void driveMotorS(double pwm){ - PwmOut up_pin_A(PB_13); - PwmOut up_pin_B(PB_14); + PwmOut up_pin_A(PB_4); + PwmOut up_pin_B(PB_5); up_pin_A.period_us(2048); up_pin_B.period_us(2048); if (!pwm) { @@ -45,7 +45,7 @@ tim=timer.read_ms(); a=0; } - if(a==1 && !limitA==0){ + if(a==1 || !limitA==0){ hassya.move(0); driveMotorS(0); Servo(0); @@ -86,6 +86,6 @@ } int main(){ timer.start(); - slave.addCMD(6,Hassya); + slave.addCMD(22,Hassya); while(true); } \ No newline at end of file