Fx0 hackathon team4
Dependencies: NySNICInterface mbed-rtos mbed
Fork of RESTServerSample by
Diff: control_motors.cpp
- Revision:
- 4:99a67256b765
- Parent:
- 2:2f187e09bdb0
- Child:
- 5:70c9f6045f2d
--- a/control_motors.cpp Sun Feb 15 01:02:58 2015 +0000 +++ b/control_motors.cpp Sun Feb 15 02:55:36 2015 +0000 @@ -71,12 +71,39 @@ // TODO // モーター制御の処理 - + if(speed > 0){ + mPwmMotorR = (float)speed/255; + mDoutMotorR1 = 1; + mDoutMotorR2 = 0; + }else if (speed < 0){ + mPwmMotorR = -(float)speed/255; + mDoutMotorR1 = 0; + mDoutMotorR2 = 1; + }else{ + mPwmMotorR = 0; + mDoutMotorR1 = 0; + mDoutMotorR2 = 0; + } + }else if(motor_id == MOTOR_LEFT){ printf("motor left speed = %d\n", speed); // TODO // モーター制御の処理 + if(speed > 0){ + mPwmMotorL = (float)speed/255; + mDoutMotorL1 = 1; + mDoutMotorL2 = 0; + }else if (speed < 0){ + mPwmMotorL = -(float)speed/255; + mDoutMotorL1 = 0; + mDoutMotorL2 = 1; + }else{ + mPwmMotorL = 0.0; + mDoutMotorL1 = 0; + mDoutMotorL2 = 0; + } + } } @@ -86,6 +113,10 @@ // TODO // モーター制御の処理 + mPwmMotorTail = 0.8; + mDoutMotorTail1 = 1; + mDoutMotorTail2 = 0; + } @@ -94,4 +125,8 @@ // TODO // モーター制御の処理 + mPwmMotorTail = 0.0; + mDoutMotorTail1 = 0; + mDoutMotorTail2 = 0; + }