staulkor
12-05-2006, 06:17 AM
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:
result VAR Byte(2)
counter VAR Word
SERIN 15, 16468, [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.
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, [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.