Go Down

Topic: [help] Servo motor control for seqeunce moving (Read 374 times) previous topic - next topic


im working on my arm robot project,,

im confused to define how do i have to control the servo motor for sequential moving..

for example ;
i want to control the servo at 30 then 60 then 90 then 120,,

int ={30,60,90,120};


do i have to use array like above or may be there are better programming algoritm for controlling servo??

i appreciate any answer of u guys..
thx for asnwering..


If you want 4 positions an array is a good idea.
An array is defined as
Code: [Select]
int servoStops[] = {30,60,90,120};

Then you can do
Code: [Select]
where the variable n has a value between 0 and 3 to identify the appropriate element.

Try it and post your code if you have a problem.

Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up