Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

continous rotating
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

continous rotating

by shengfatt on Wed Aug 27, 2008 12:53 am

i physically modified the mini servo that i bought and now i am stuck in programming it to move 360 degree continuosly using the motorshield, i use the ServoTimer1 library and the example program:
Code: Select all | TOGGLE FULL SIZE
#include <ServoTimer1.h>

ServoTimer1 servo1;
ServoTimer1 servo2;

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Servo test!");

  servo2.attach(9);
  servo1.attach(10);
}


void loop() {
  Serial.print("tick");
  servo1.write(180);
  servo2.write(0);
  delay(1000);

  Serial.print("tock");
  servo1.write(0);
  servo2.write(180);
  delay(1000);
}


the motor stop and move, move and stop like tick, tock,tick tock but in 360 degree (full circle).

i want my servo to move 360 degree forward, sometimes backwards, (because the servo is used as the wheel for my robot) without any pulse(stops). anyone can guide me on this programming?
shengfatt
 
Posts: 3
Joined: Wed Aug 27, 2008 12:39 am

by adafruit on Wed Aug 27, 2008 10:53 am

if you input different 'angles' youll get different speeds
but without a sensor its impossible to get exactly 360 degrees.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by shengfatt on Thu Aug 28, 2008 9:34 am

ladyada wrote:if you input different 'angles' youll get different speeds
but without a sensor its impossible to get exactly 360 degrees.


ok, different angles = different speed, thank you.

but my servo move and stop, move and stop,
1) how to program it continuous moving without stop(pulse)? :)
2) how to program it turning another way(anticlockwise)?
shengfatt
 
Posts: 3
Joined: Wed Aug 27, 2008 12:39 am

by gekoch on Fri Aug 29, 2008 1:05 am

for 1) check tis page
http://www.arduino.cc/playground/Compon ... ervotimer1

So it doesn't interupt your loop sequence with a delay.

And for 2) how do you control your Robot?

Geko

gekoch
 
Posts: 20
Joined: Tue Aug 12, 2008 2:08 pm

by mooseheadm5 on Fri Aug 29, 2008 11:37 am

I have used a stepper system that rotates in reverse when you give it a negative angle. Maybe that will work?

mooseheadm5
 
Posts: 79
Joined: Wed Aug 20, 2008 9:01 pm

Please be positive and constructive with your questions and comments.


cron