Let's Make Robots!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

do you have some type of motor controller?

alegiaco's picture

No motor controller. The servos are wired directly with arduino. The power is done by 5x1.2V batteries.

Looks good!

I think, that if you have the servo turn a bit slower, it will be more accurate in it's readings, making less false turns

alegiaco's picture

Do you know a method to control the servos speed? interesting!

patrickmccabe's picture

Yeah a for loop works. This is just a little example I wrote for you. It will show you how to slow the servo so you can write something similar for your bot.

 

void loop(){

servo.write(0);  //move the servo to the angle 0

delay(700);      // wait for the servo to move to angle 0

for( int x=0; x<=180; x++){   // This will loop 180 times

servo.write(x);            //set the servo to angle x

delay(10); // play with this delay value that will slow the servo

}

}

alegiaco's picture

Thanks, but I already use this program structure (http://robottini.altervista.org/robot-with-obstacle-avoidances/)

 

 for (ang=0; ang<180; ang +=5) // obstacles control
            {
              uservo.write(ang); // set ultrasonic sensor on ang value
              urm.requestMeasurement(DISTANCE); //ask for new reading
              delay(20);

 

.......