Dyanamixel

Dependents:   YOZAKURA_ARM YOZAKURA_ARM_USB YOZAKURA_ARM_USB_Keyboard YOZAKURA_ARM_Keyboard0424 ... more

Files at this revision

API Documentation at this revision

Comitter:
yusuke_kyo
Date:
Sat Apr 25 06:01:21 2015 +0000
Parent:
8:4b2c48ab30fe
Commit message:
Thermo_Sensor

Changed in this revision

AX12.cpp Show annotated file Show diff for this revision Revisions of this file
AX12.h Show annotated file Show diff for this revision Revisions of this file
MX28.cpp Show annotated file Show diff for this revision Revisions of this file
MX28.h Show annotated file Show diff for this revision Revisions of this file
--- a/AX12.cpp	Fri Apr 24 03:21:14 2015 +0000
+++ b/AX12.cpp	Sat Apr 25 06:01:21 2015 +0000
@@ -385,6 +385,8 @@
         }
 
     } // if (ID!=0xFE)
+    
+    if(Status[4]!=0) printf("\nError Code : 0x%x\n", Status[4]);
 
     return(Status[4]);
 }
@@ -492,5 +494,7 @@
 
     }
 
+    if(Status[4]!=0) printf("\nError Code : 0x%x\n", Status[4]);
+
     return(Status[4]); // return error code
 }
--- a/AX12.h	Fri Apr 24 03:21:14 2015 +0000
+++ b/AX12.h	Sat Apr 25 06:01:21 2015 +0000
@@ -30,7 +30,7 @@
 #define AX12_WRITE_DEBUG 0
 #define AX12_READ_DEBUG 0
 #define AX12_TRIGGER_DEBUG 0
-#define AX12_DEBUG 1
+#define AX12_DEBUG 0
 
 #define AX12_REG_ID 0x3
 #define AX12_REG_CW_LIMIT 0x06
--- a/MX28.cpp	Fri Apr 24 03:21:14 2015 +0000
+++ b/MX28.cpp	Sat Apr 25 06:01:21 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,9 @@
     }
     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));
+    float current = nama*10;
     return(current);
 }
 
@@ -397,6 +399,7 @@
         }
 
     } // if (ID!=0xFE)
+    if(Status[4]!=0) printf("\nError Code : 0x%x\n", Status[4]);
 
     return(Status[4]);
 }
@@ -503,6 +506,7 @@
 
 
     }
+    if(Status[4]!=0) printf("\nError Code : 0x%x\n", Status[4]);
 
     return(Status[4]); // return error code
 }
--- a/MX28.h	Fri Apr 24 03:21:14 2015 +0000
+++ b/MX28.h	Sat Apr 25 06:01:21 2015 +0000
@@ -30,7 +30,7 @@
 #define MX28_WRITE_DEBUG 0
 #define MX28_READ_DEBUG 0
 #define MX28_TRIGGER_DEBUG 0
-#define MX28_DEBUG 1
+#define MX28_DEBUG 0
 
 #define MX28_REG_ID 0x3
 #define MX28_REG_CW_LIMIT 0x06
@@ -43,7 +43,7 @@
 #define MX28_REG_MOVING 0x2E
 #define MX28_REG_POSITION 0x24
 #define MX28_REG_TORQUE_LIMIT 0x22
-#define MX28_REG_CURRENT 0x44
+#define MX28_REG_CURRENT 0x38
 
 #define MX28_MODE_POSITION  0
 #define MX28_MODE_ROTATION  1