Servo Pin Numbers

Hello

I have a short question about the code generated from the PowerPod program.

Why are the servo pin numbers stored in two constants? Like this…

RRHH con "0" ;Rear Right leg : Hip Horizontal : pin 0 RRHH2 con "0"

My guess is it deals with the ascii format for the commands and the fact that there are 00 to 31 channels.

Ok. The reason why I am asking is because also saw this command in the code.

for Index = 0 to 27 ;preserve servo 28 (Deck Tilt),29 and 30 (Little Gripper),31 (Deck) serout SSC32,I8N1_38400,"#",DEC Index,"P1500"] next serout SSC32,I8N1_38400,"T576",13]

And here the pin numbers are not used through two variables just one, Index. And also it is used together with DEC.

In the first example, two ASCII characters are used, supposedly using a byte table instead.

Second example passes the servo number in a variable, my preferred way. The SSC-32 wants ASCII characters, DEC puts these in the string sent to the SSC-32.

Alan KM6VV

Okay, so by using the first method one dosn’t have to worry about the DEC. The reason for using two constants is beacause if one did something like this, FLHH con “21”, one would get the wrong ASCII characters?

You should get the right ASCII characters, but I suspect the author intended to use a constant or variable (of some sort), so that the pin assignments could be defined in a table at the start of the program. Makes it easier to modify just one set of “defines”.

The other case was in a loop, where the code cycles through a range of servos to be set with the same value.

So two different uses. both are correct and serve their purposes.

Alan KM6VV

Okay. Thanks for confirming that Alan :slight_smile: