Im trying to use an AX-18A servo with my arduino but even the example sketches with the library wont compile. I´ve tried both the AX-12A and ardyno library.
AX-12A library error Move example:
/var/folders/21/l9c_p4wn6c36lkxbf3pbh3c40000gp/T/arduino_modified_sketch_684879/Move.ino: In function 'void setup()':
Move:21:45: error: no matching function for call to 'AX12A::begin(long unsigned int, unsigned int, Serial_)'
ax12a.begin(BaudRate, DirectionPin, &Serial);
^
In file included from /var/folders/21/l9c_p4wn6c36lkxbf3pbh3c40000gp/T/arduino_modified_sketch_684879/Move.ino:6:0:
/Users/something/Documents/Arduino/libraries/AX-12A-servo-library/src/AX12A.h:153:7: note: candidate: void AX12A::begin(long int, unsigned char, HardwareSerial)
void begin(long baud, unsigned char directionPin, HardwareSerial srl);
^~~~~
/Users/something/Documents/Arduino/libraries/AX-12A-servo-library/src/AX12A.h:153:7: note: no known conversion for argument 3 from 'Serial_' to 'HardwareSerial*'
exit status 1
no matching function for call to 'AX12A::begin(long unsigned int, unsigned int, Serial_*)'
.
.
.
ardyno library example Joint mode:
joint_mode:14:44: error: no matching function for call to 'HardwareDynamixelInterface::HardwareDynamixelInterface(Serial_&)'
HardwareDynamixelInterface interface(Serial);
^
In file included from /Users/something/Documents/Arduino/libraries/ardyno/src/DynamixelInterface.h:62:0,
from /Users/something/Documents/Arduino/libraries/ardyno/src/DynamixelMotor.h:9,
from /Users/something/Documents/Arduino/libraries/ardyno/examples/joint_mode/joint_mode.ino:3:
/Users/something/Documents/Arduino/libraries/ardyno/src/DynamixelInterfaceArduinoImpl.h:80:2: note: candidate: HardwareDynamixelInterface::HardwareDynamixelInterface(HardwareSerial&, uint8_t)
HardwareDynamixelInterface(HardwareSerial &aSerial, uint8_t aDirectionPin=NO_DIR_PORT);
^~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/something/Documents/Arduino/libraries/ardyno/src/DynamixelInterfaceArduinoImpl.h:80:2: note: no known conversion for argument 1 from 'Serial_' to 'HardwareSerial&'
/Users/something/Documents/Arduino/libraries/ardyno/src/DynamixelInterfaceArduinoImpl.h:77:7: note: candidate: constexpr HardwareDynamixelInterface::HardwareDynamixelInterface(const HardwareDynamixelInterface&)
class HardwareDynamixelInterface:public DynamixelInterfaceImpl
^~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/something/Documents/Arduino/libraries/ardyno/src/DynamixelInterfaceArduinoImpl.h:77:7: note: no known conversion for argument 1 from 'Serial_' to 'const HardwareDynamixelInterface&'
exit status 1
no matching function for call to 'HardwareDynamixelInterface::HardwareDynamixelInterface(Serial_&)'
// Test motor joint mode
#include "DynamixelMotor.h"
// id of the motor
const uint8_t id=1;
// speed, between 0 and 1023
int16_t speed=512;
// communication baudrate
const long unsigned int baudrate = 1000000;
// hardware serial without tristate buffer
// see blink_led example, and adapt to your configuration
HardwareDynamixelInterface interface(Serial);
DynamixelMotor motor(interface, id);
void setup()
{
interface.begin(baudrate);
delay(100);
// check if we can communicate with the motor
// if not, we turn the led on and stop here
uint8_t status=motor.init();
if(status!=DYN_STATUS_OK)
{
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
while(1);
}
motor.enableTorque();
// set to joint mode, with a 180° angle range
// see robotis doc to compute angle values
motor.jointMode(204, 820);
motor.speed(speed);
}
void loop()
{
// go to middle position
motor.goalPosition(512);
delay(500);
// move 45° CCW
motor.goalPosition(666);
delay(500);
// go to middle position
motor.goalPosition(512);
delay(500);
// move 45° CW
motor.goalPosition(358);
delay(500);
}