Robot secondaire

Dependencies:   RoboClaw mbed StepperMotor

Fork of RoboClaw by Simon Emarre

Revision:
51:1056dd73a748
Parent:
50:2dea82393beb
Child:
71:5590dbe8393a
--- a/AX12/AX12.cpp	Mon May 02 08:35:56 2016 +0000
+++ b/AX12/AX12.cpp	Wed May 04 16:15:13 2016 +0000
@@ -296,9 +296,10 @@
 
 float AX12::getLoad (void) {
     char data[2];
-    int ErrorCode = read(_ID, AX12_REG_VOLTS, 2, data);
-    float volts = data[0]/10.0;
-    return(volts);
+    int ErrorCode = read(_ID, AX12_REG_LOAD, 2, data);
+    short load1 = data[0] + (data[1] << 8);
+    float load = load1/1023;
+    return(load); //renvoie la charge en % 
 }
 
 int AX12::read(int ID, int start, int bytes, char* data) {