
Dunning-Kruger

Trying to send the below code via serial to my SSC-32 servo board to test servo movement... it gives me an error because $pw is greater than 255 (max for a byte which I do understand)... It's probably me not getting it, but how do I send numbers greater than 255?
This is the error "Error on line 6: Value was either too large or too small for an unsigned byte."Code:
$pw=1000
$m =2500
UARTInit(0,1,9600)
:start
$pw=1000
UARTWrite(0,1,"#0P",$pw,"T",$m,13)
sleep(2500)
$pw=2000
UARTWrite(0,1,"#0P",$pw,"T",$m,13)
sleep(2500)
Goto(start)
Have you tried;
Code:
In other words, having the whole "#0 1000 T 2500" part sent in one go rather than piece by piece.
Note, I prefer to use hex for ascii characters hence the 0x0D rather than the 13 for a carriage return. 13 may work fine.
Also, are you missing the "P" so should it be
Code:
or with your code
Code:
Edit: I guess you edited before I finished typing and added that P in
$pw = 1000
to
$pw = "1000"
I'll have a proper look tomorrow but I need sleep, just thought I'd throw a couple of ideas at you before I head up though (it's also an insight in to how I guess at things if I don't know.
Code:
Cheers and thanks....
Code:
Just out of curiosity, why not use SendSerial? Not that it makes much of a difference (in fact, I don't even know what the difference would be other than the command used and it's syntax).
Cheers
@Dave, I don't think you can use SendSerial on UART port 0.... It doesn't seem to have a port designation (like D0 - D23) and the SendSerial command needs that as it's first parameter....
@Rich and @RichardR, that's what I thought. I just wanted to clarify this point. When the Sendserial command was brought up a few posts back I thought I had missed something. I've been using my Kangaroo/Sabertooth board combo on UART0 and using the UART commands with much success and am very happy with it. I just always like to know if there are any other ways to do something.
On a related note (you guys probably know this); When using the UART0 port it always has to be initialized the first time you use it after power up by using the UARTInit command.
Example: UARTInit(0, 0, 9600 ).
Once initialized you don't have to send that command again till the next power up.
You are also correct that the UART port only needs one Init command as long as the EZB(4) remains powered.