
Dunning-Kruger
Canada
Asked
— Edited

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."
$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)
Bearing in mind I've not used the UARTWrite function yet nor the SCC32 but...
Have you tried;
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
or with your code
Edit: I guess you edited before I finished typing and added that P in
Suggestion #2... change
$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.
Crap.... you're a genius Rich... this worked...
Cheers and thanks....
This now works....
Awesome
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).
No reason, just got used to using the Uart commands when I was messing with my iRobot Create.... kind of a habit now... I guess I could just go back to sendserial....
Cheers
Can you use the Sendserial command on Uart 0 port of V4?
You have to specify the Digital port when using the SendSerial command. Don't know which d port is associated with UART 0.