code of robot bike

Dependencies:   SDFileSystem mbed

Fork of Robot_Bicycle by Chris LU

Revision:
1:709be64ca63c
Parent:
0:830ddddc129f
Child:
3:197b748a397a
--- a/RobotServo.cpp	Thu Jun 09 09:46:38 2016 +0000
+++ b/RobotServo.cpp	Tue Jun 21 18:11:46 2016 +0000
@@ -13,8 +13,8 @@
 PwmOut pwm_rk(D13);  //right knee
 PwmOut pwm_ra(D14);  //right ankle
 PwmOut pwm_rs(D15);  //right shoulder
-PwmOut pwm_re(PA_9); //right elbow
-PwmOut pwm_rw(PA_8); //right wrist
+PwmOut pwm_re(PC_9); //right elbow
+PwmOut pwm_rw(PC_8); //right wrist
 
 const int servoangle_left[TOT_ARM_POS][3] = {   {-7,0,-25},{-5,0,-30},{-6,0,-28},{-7,0,-26},{-27,28,-33},{-36,39,-32},{-44,46,-30},{-50,52,-28},{-56,57,-26},{-61,62,-24},
                                         {-66,65,-21},{-70,68,-19},{-75,71,-17},{-79,74,-14},{-83,76,-12},{-87,78,-10},{-90,80,-7},{-94,81,-5},{-97,83,-2},{-101,84,0},
@@ -249,5 +249,5 @@
 }
 int angle_to_duty(int resolution, float degree)
 {//+-90 degrees
-  return (degree / 90.0 * 0.0008 + 0.0015) * 244 * resolution;
+  return (int)((degree / 90.0f * 0.0008f + 0.0015f) * 244.0f * resolution);
 }
\ No newline at end of file