Dyanamixel
Dependents: YOZAKURA_ARM YOZAKURA_ARM_USB YOZAKURA_ARM_USB_Keyboard YOZAKURA_ARM_Keyboard0424 ... more
Diff: MX28.cpp
- Revision:
- 9:0927a7b74806
- Parent:
- 8:4b2c48ab30fe
- Child:
- 11:cb0d11254b22
--- a/MX28.cpp Fri Apr 24 03:21:14 2015 +0000 +++ b/MX28.cpp Fri Apr 24 17:07:46 2015 +0000 @@ -66,7 +66,7 @@ // 4095 / 360 * degrees short goal = (4095 * degrees) / 360; if (MX28_DEBUG) { - printf("SetGoal to 0x%x\n",goal); + printf("SetGoal to %d[degrees], 0x%x\n",degrees,goal); } data[0] = goal & 0xff; // bottom 8 bits @@ -274,7 +274,10 @@ } char data[2]; int ErrorCode = read(_ID, MX28_REG_CURRENT, 2, data); - float current = (data[0]+(data[1] << 8)-0x800)*0.0045; +// float current = ((data[0]+(data[1] << 8))-0x800)*0.0045; + short nama = (data[0]+(data[1] << 8)); + printf("%d",nama); + float current = nama*10; return(current); } @@ -397,6 +400,7 @@ } } // if (ID!=0xFE) + if(MX28_ERROR_DEBUG && Status[4]!=0) printf("\nError Code : 0x%x\n", Status[4]); return(Status[4]); } @@ -503,6 +507,7 @@ } + if(MX28_ERROR_DEBUG && Status[4]!=0) printf("\nError Code : 0x%x\n", Status[4]); return(Status[4]); // return error code }