sparki.motorsRotateSteps

Salut,

has anyone had success to call sparki.motorsRotateSteps more than once in the loop?
I call it to move the robot a defined way backward. Then I call it to turn the robot for a defined angle. Both moves are fixed numbers of steps. I call sparki.motorsRotateSteps with wait=true.
The first call gets executed ok, The second one leaves the robot locked for approximately 3 seconds with no motor activity.
The complete code is:

[code]
#include <Sparki.h> // include the sparki library

void setup()
{
sparki.servo(SERVO_CENTER);
}

void loop()
{
sparki.RGB(RGB_GREEN); // turn the light green
int cm = sparki.ping(); // measures the distance with Sparki’s eyes
sparki.motorRotate( MOTOR_LEFT, DIR_CCW, 250);
sparki.motorRotate( MOTOR_RIGHT, DIR_CW, 250);

if(cm != -1) // make sure its not too close or too far
{
if(cm < 20) // if the distance measured is less than 10 centimeters
{
sparki.RGB(RGB_RED); // turn the light red
sparki.beep(); // beep!
sparki.motorsRotateSteps( DIR_CW, DIR_CCW, 250, 2600, true);

  sparki.beep(); // beep!
  sparki.motorsRotateSteps( DIR_CW, DIR_CW,  250, 1300, true);

  sparki.beep(); // beep!
}

}
delay(100); // wait 0.1 seconds (100 milliseconds)
}[/code]

This robot is no fun…

Ciao, Mathias

Hi Mathias,

motorsRotateSteps isn’t meant to be used outside of internal use. This is currently an undocumented and unsupported functions. We recommend using the moveForward, moveBackward, moveRight, moveLeft commands instead.

Salut,

well as the routine is in the public section of the sparki class I thought it is public. Too bad that it cannot be used as one specialty of the sparki is the stepper motors instead of the normal hobby motors. It would be ok if the routines you mention were working ok but with these the robot craws like a snake because you hard-coded the speed to 100 out of a non-linear range from 0-254. I suggest for a later release to introduce a constant MAX_SPEED (to be 254 or less) and then use the map command to map the 0-110% speed to map to that interval in all moveForward, moveBackward etc…

pretty disappointing

Mathias

I’d love to have a faster Sparki

Thanks for sharing such information. I like that keep it up


Our fantastic offers for free ccnp routing dumps and sas certification study security plus exam prepare you well for the final ccna certified - pass4-sure exam and www.kumc.edu papers with great success of Johns Hopkins University