Vr204 & VRSSM issues

Hi. the following prog works as expected when a servo is attached to the UNO directly.

#include <Servo.h>
#include <ALLBOT.h>

ALLBOT BOT(1); // Number of motors

enum MotorName { // Giving each motor a name
hipLeft,
hipRight,
ankleRight,
ankleLeft,
};

int speedms;

void setup()
{
// myservo.attach(1); // attaches the servo on pin 1 to the servo object
// myservo.write(90); // sets the servo position to 90° (is half of 180°)

BOT.attach(hipLeft, 11, 90, 1, 0);
// BOT.attach(hipRight, 3, 90, 0, 0);
// BOT.attach(ankleLeft, 12, 90, 1, 0);
// BOT.attach(ankleRight, 2, 90, 0, 0);

delay(500 ); // waits for the servo to get there

}

void loop()
{

BOT.move(hipLeft, 180);
// BOT.move(hipRight, 180);
BOT.animate(500);
delay(1500);
BOT.move(hipLeft, 0);
// BOT.move(hipRight, 180);
BOT.animate(500);
delay(1500);
}

But does nothing when using the shield???
the motor just turns and locks at the end. What gives?
(YES, all the shunts are on the UNO position. VRSSM shield on top of uno, with a 2 pin offset on the shield.(skipping ioref & rst) )

I cant get all 4 servos to work on the shield, as soon as I power it up all servos twist and lock on end positions using the ‘original sketch’, sound works though :smiley:

ideas?

Hello deixis,

Maybe if the allbot is assembled, and the servo’s are not centered correctly.
When power up this sketch with the shield onto arduino, and the servo’s are not centered,
servo’s can go in wrong position (to end) and lock.

Use the servo centering sketch (see below) at the same time when building the allbot and pay attention on SERVO ALIGNMENT. §29 https://manuals.velleman.eu/article.php?id=389

code for centering servo’s:

/*Center Servo
 * Copyright (C) 2014 Velleman nv
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 *
 */
#include <Servo.h>

Servo myservo;  // create servo object to control a servo

void setup()
{
  myservo.attach(1);  // attaches the servo on pin 1 to the servo object
}

void loop() 
{
  myservo.write(90);                   // sets the servo position to 90° (is half of 180°)
  delay(15);                           // waits for the servo to get there 
} 

Maybe this will help you further.
Best regards,

Velleman support