BS2, 2 Servos, and multiple variables inputed through SERIN
staulkor
Posts: 5
I am working on a 360 degree pan and tilt device. I have 2 parallax continuous rotation servos. I am using an older Homework Board Rev B. I am trying to figure out how to use the SERIN command. I have played with it so i can enter "1" and it turns on a LED, but I havent got it so I can enter a few numbers and for the program to use those numbers to position the servos.
This is pretty much what I need done, but I have no clue how to do it:
- Able to enter multi-digit numbers, like 850, 50, etc to position the servos
I have tried using Arrays, but I have only been able to get a 1 digit number instead of multi-digit numbers.
Here is an excerpt from the code i am using now:
Also, with the current code, I have phantom movements with the servos. They just go crazy and spin until I plug the serial cable into the port I made on port 15.
This is pretty much what I need done, but I have no clue how to do it:
- Able to enter multi-digit numbers, like 850, 50, etc to position the servos
I have tried using Arrays, but I have only been able to get a 1 digit number instead of multi-digit numbers.
Here is an excerpt from the code i am using now:
result VAR Byte(2) counter VAR Word SERIN 15, 16468, [noparse][[/noparse]STR result \2] FOR counter = 1 TO result(0) PULSOUT 14, 650 PAUSE 10 NEXT FOR counter = 1 TO result(1) PULSOUT 13, 650 PAUSE 10 NEXT
Also, with the current code, I have phantom movements with the servos. They just go crazy and spin until I plug the serial cable into the port I made on port 15.
Comments
So, if you DO use a modified servo, you'll need a 'position encoder' to tell you exactly what position the rotor is in.
You declared "result" as a byte array so your limited from 0 to 255 per byte
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Have Fun
TR
Post Edited (TechnoRobbo) : 12/6/2006 1:31:32 AM GMT