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.h Source File

AX12.h

00001 /* mbed AX-12+ Servo Library
00002  *
00003  * Copyright (c) 2010, cstyles (http://mbed.org)
00004  *
00005  * Permission is hereby granted, free of charge, to any person obtaining a copy
00006  * of this software and associated documentation files (the "Software"), to deal
00007  * in the Software without restriction, including without limitation the rights
00008  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00009  * copies of the Software, and to permit persons to whom the Software is
00010  * furnished to do so, subject to the following conditions:
00011  *
00012  * The above copyright notice and this permission notice shall be included in
00013  * all copies or substantial portions of the Software.
00014  *
00015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00016  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00017  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00018  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00019  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00020  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00021  * THE SOFTWARE.
00022  */
00023 
00024 #ifndef MBED_AX12_H
00025 #define MBED_AX12_H
00026 
00027 #include "mbed.h"
00028 #include "SerialHalfDuplex.h"
00029 #include "MX.h"
00030 
00031 #define AX12_WRITE_DEBUG 1
00032 #define AX12_READ_DEBUG 1
00033 #define AX12_TRIGGER_DEBUG 1
00034 #define AX12_DEBUG 1
00035 
00036 #define AX12_REG_ID 0x3
00037 #define AX12_REG_CW_LIMIT 0x06
00038 #define AX12_REG_CCW_LIMIT 0x08
00039 #define AX12_REG_GOAL_POSITION 0x1E
00040 #define AX12_REG_MOVING_SPEED 0x20
00041 #define AX12_REG_VOLTS 0x2A
00042 #define AX12_REG_TEMP 0x2B
00043 #define AX12_REG_MOVING 0x2E
00044 #define AX12_REG_POSITION 0x24
00045 
00046 #define AX12_MODE_POSITION  0
00047 #define AX12_MODE_ROTATION  1
00048 
00049 #define AX12_CW 1
00050 #define AX12_CCW 1
00051 
00052 /** Servo control class, based on a PwmOut
00053  *
00054  * Example:
00055  * @code
00056  * #include "mbed.h"
00057  * #include "AX12.h"
00058  * 
00059  * int main() {
00060  * 
00061  *   AX12 myax12 (p9, p10, 1);
00062  *
00063  *   while (1) {
00064  *       myax12.SetGoal(0);    // go to 0 degrees
00065  *       wait (2.0);
00066  *       myax12.SetGoal(300);  // go to 300 degrees
00067  *       wait (2.0);
00068  *   }
00069  * }
00070  * @endcode
00071  */
00072 class AX12 : public MX {
00073 
00074 public:
00075 
00076     AX12(communication_1& line, int ID, float gear_train);
00077     virtual void setMode(int mode);
00078 
00079 };
00080 
00081 #endif
00082