You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to rotate the servo motor in continuous mode. Then, I tried to get the instantaneous velocity. However, I only get -1 which means that there is a problem with reading the velocity. I tested more than one motor and still get -1.
Here is the simple code:
#include <Herkulex.h>
int n=0xfe; //motor ID - verify your ID !!!!
void setup()
{
delay(2000); //a delay to have time for serial monitor opening
Serial.begin(115200); // Open serial communications
Serial.println("Begin");
Herkulex.beginSerial1(115200); //open serial port 1
Herkulex.reboot(n); //reboot first motor
delay(500);
Herkulex.initialize(); //initialize motors
delay(200);
Herkulex.setLed(n,LED_GREEN2); //set the led to green
delay(1000);
Herkulex.setLed(n, LED_CYAN);
}
void loop(){
Herkulex.moveSpeedOne(n,300, 100, LED_BLUE); //move motor with 300 speed
Serial.println(Herkulex.getSpeed(n));
delay(100);
}
I will be appreciated if you can help.
The text was updated successfully, but these errors were encountered:
I won't be able to offer much help. It's been years since I last used those servos, and I don't have any available right now.
That being said, I remember that the functionality in continuous rotation mode is limited. Many commands only work in position mode. Check the datasheet to see if the function is supported. Also, try changing the code to position control mode to see if it works in that case...
Hello, thanks a lot for your toolbox.
I am trying to rotate the servo motor in continuous mode. Then, I tried to get the instantaneous velocity. However, I only get -1 which means that there is a problem with reading the velocity. I tested more than one motor and still get -1.
Here is the simple code:
#include <Herkulex.h>
int n=0xfe; //motor ID - verify your ID !!!!
void setup()
{
delay(2000); //a delay to have time for serial monitor opening
Serial.begin(115200); // Open serial communications
Serial.println("Begin");
Herkulex.beginSerial1(115200); //open serial port 1
Herkulex.reboot(n); //reboot first motor
delay(500);
Herkulex.initialize(); //initialize motors
delay(200);
delay(1000);
Herkulex.setLed(n, LED_CYAN);
}
void loop(){
Herkulex.moveSpeedOne(n,300, 100, LED_BLUE); //move motor with 300 speed
Serial.println(Herkulex.getSpeed(n));
delay(100);
}
I will be appreciated if you can help.
The text was updated successfully, but these errors were encountered: