Debugged library

Dependents:   MX106-finaltest dynamixel Arm_dynamixel_can Arm_dynamixel_can_procedurale

Fork of AX12_v2 by Team DIANA

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers AX12.cpp Source File

AX12.cpp

00001 #include "AX12.h"
00002 #include "mbed.h"
00003 #include <cmath>
00004 #define AX12_DEBUG 1
00005 
00006 AX12::AX12(communication_1& line, int ID, float gear_train) 
00007   : MX(line, ID, gear_train) {
00008 }
00009 
00010 // Set the mode of the servo
00011 //  0 = Positional (0-300 degrees)
00012 //  1 = Rotational -1 to 1 speed
00013 void AX12::setMode(int mode) {
00014     switch (mode) {
00015         //Wheel Mode
00016         case (0):
00017             setCWLimitUnits(0);
00018             setCCWLimitUnits(0);
00019             //setCRSpeed(0.0);
00020             break;
00021         //Joint Mode
00022         case (1):
00023             setCWLimit(360);
00024             setCCWLimit(360);
00025             //setCRSpeed(0.0);
00026             break;
00027         default:
00028             if (READ_DEBUG) {
00029                 printf("Not valid mode for AX12");
00030                 return;
00031             }
00032     }
00033     _mode = mode;
00034 }
00035