HELP : SC16A - Moving 2 Servos Together (URGENT)

Autonomous Robot, Manual Robot, DC Motor Driver, Stepper Motor Driver, Servo, Multi PWM chip.....

HELP : SC16A - Moving 2 Servos Together (URGENT)

Postby zekonology » Tue Nov 30, 2010 9:47 am

Hi,

My project requires me to use two servos. Let say I have servo1 and servo2. I use C on my PC to send commands to SC16A through USB/COM port.

This is the current problem that I am facing. I moved servo1 to a position. After that I send another 4 bytes command to SC16A to moves servo2. However, servo1 will not hold back the position and will be released.

My question:

1. How do I hold back servo1 in the same time move servo2?
2. How to move two servos together (servo1 and servo2) and hold the position of both servos.

Thank You.
zekonology
Greenhorn
 
Posts: 2
Joined: Tue Nov 30, 2010 9:32 am

Re: HELP : SC16A - Moving 2 Servos Together (URGENT)

Postby hyng » Tue Nov 30, 2010 11:56 am

hi,

Regarding on your question, the first servo should be holding on its position. The servos will hold the position after its move to that position if there is no more command for it to execute. Have you try with the sample source code? please try with that source code first to verify if the SC16A is working. You can also post your programming code.
User avatar
hyng
Moderator
 
Posts: 292
Joined: Thu Apr 16, 2009 11:35 am

Re: HELP : SC16A - Moving 2 Servos Together (URGENT)

Postby zekonology » Tue Nov 30, 2010 1:25 pm

I already tried your source code. I did not use microcontroller in my project. Thus, I only tried your VB source code. From your VB SC16A GUI, Servo1 will not hold its position after we moved the second servo.

My program moves the 1st servo and after few seconds it then moves the 2nd servo, however the 1st servo does not hold the position as soon as the 2nd servo moves. My question was and still,

1. How do I hold back servo1 in the same time move servo2?
- I want to hold the 1st servo and after a few seconds, move the next servo.


2. How to move two servos together (servo1 and servo2) and hold the position of both servos in VB. I tried sending 8 bytes together but it did not work.

This is my code in C to send the 4bytes command:

void set_com_pin(int servo, int high, int low, int speed)
{
char data = (char)servo;
char data2 = (char)high;
char data3 = (char)low;
char data4 = (char)speed;
DWORD written;

WriteFile(hPort, &data, 1, &written, NULL); // the 1st byte
WriteFile(hPort, &data2, 1, &written, NULL); // the 2nd byte
WriteFile(hPort, &data3, 1, &written, NULL); //the 3rd byte
WriteFile(hPort, &data4, 1, &written, NULL); //the 4th byte

}
zekonology
Greenhorn
 
Posts: 2
Joined: Tue Nov 30, 2010 9:32 am


Return to Robot Controller

Who is online

Users browsing this forum: No registered users and 3 guests

cron