BS2 to BS2 serin/serout
ROVONE
Posts: 8
I want to control 3 servos by inputting joy stick inputs to one BS2 and then sending that data to a second BS2 over a 3 wire serial cable and have the second BS2 drive the three servos. I have a setup with one servo that works. What I am having problems with is sending 3 variables and loading them as 3 separate variables to drive the 3 servos. What would be the best way to do this?
Comments
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Yesterday is history, tomorrow is a mystery, and today is a gift.
That is why they call it the present.
Don't have VGA?
Newzed@aol.com
·
So, BS2 #1 reads the joysticks, and does a SEROUT of the 'attention' byte -- "H". It then goes into a SERIN with a WAIT of 2 mSec for BS#2 to respond. If BS2 #2 does not respond, then BS2 #1 tries again -- say three times.
If BS2 #2 does not respond in three tries, BS2 #1 goes around to read the joystick positions again.
Now, if BS2 #1 DOES recieve the 'acknowledge' byte -- "A" -- it waits 1 mSec (so the reciever can get into its SERIN statement) then sends the three servo positions. If BS2 #2 gets all three, again it sends the "A", before setting the servos to their new positions.
This implements a very simple "software handshake", where both sides don't waste too much time waiting for each other, but do eventually 'synchronize' so the listener is listening when the talker wants to talk.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔