Go Down

Topic: Lobot LD20MG Digital Continuous Servo (Read 58 times) previous topic - next topic

acdavis1999

Hello, I am using a digital servo to attempt to run the example sweep servo command, but the servo automatically starts spinning as soon as the ground and power is connected. Unsure of how to get it to follow the commands again.

outsider

#1
Nov 16, 2018, 04:54 am Last Edit: Nov 16, 2018, 05:05 am by outsider
I believe that is a continuous rotation servo, it does not have position control, it will stand still somewhere around  90 degrees (1500 microseconds) and turn faster the farther you write from 90 degrees + / -.
Try this test sketch with servo signal wire connected to pin 9. Use microSeconds instead of degrees. It's a 7.4V servo so don't try to power it from the Arduino's 5V pin.
Code: [Select]
/*
 Try this test sketch with the Servo library to see how your
 servo responds to different settings, type a position
 (0 to 180) or if you type a number greater than 180 it will be
 interpreted as microseconds(544 to 2400), in the top of serial
 monitor and hit [ENTER], start at 90 (or 1472) and work your
 way toward zero (544) 5 degrees (or 50 micros) at a time, then
 toward 180 (2400).
*/
#include <Servo.h>
Servo servo;

void setup() {
  // initialize serial:
  Serial.begin(9600); //set serial monitor baud rate to match
  servo.write(90);
  servo.attach(9);
  prntIt();
}

void loop() {
  // if there's any serial available, read it:
  while (Serial.available() > 0) {

    // look for the next valid integer in the incoming serial stream:
    int pos = Serial.parseInt();
    pos = constrain(pos, 0, 2400);
    servo.write(pos);
    prntIt();
  }
}
void prntIt()
{
  Serial.print("  degrees = ");
  Serial.print(servo.read());
  Serial.print("\t");
  Serial.print("microseconds =  ");
  Serial.println(servo.readMicroseconds());
}

Also, check the info on this page:
https://alexnld.com/product/lobot-ld-20mg-20kg-large-torque-metal-gear-digital-servo-for-rc-models/

Go Up