Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not get feedback value (motor speed) #5

Open
ibrahimseleem opened this issue Jun 15, 2023 · 1 comment
Open

Can not get feedback value (motor speed) #5

ibrahimseleem opened this issue Jun 15, 2023 · 1 comment

Comments

@ibrahimseleem
Copy link

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);

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.

@cesarvandevelde
Copy link
Owner

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants