Community Question

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)

Richard R
Commented July 2014
Uart 1 send is on port D5, receive is on D6.... Uart port 2 send is D18 and receive is D19... UART port 0 as Dave pointed out is the black 4 pin port on the right side of the picture he provided above...

@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
Commented July 2014
You would need to use UARTWrite on UART0
Dave Schulpius
Commented July 2014
"You would need to use UARTWrite on UART0"

@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.
Robot Doc
Commented July 2014
Dave, a few posts back I mentioned that you needed a digital port defined in order to use the SendSerial commands. I understood the question and also knew where the UART 0 connection is located since I'm using it for sending Roomba commands. The point I was attempting to make (although poorly) was that since the UART 0 ports are not identified as single Digital ports like UART 1 and UART 2 are, that the SendSerial command cannot be used.

You are also correct that the UART port only needs one Init command as long as the EZB(4) remains powered.
Dave Schulpius
Commented July 2014
Thanks @Robot-Doc, I understand now. You did not do a poor job. Your advice is always welcomed and concise. ;)
Question
AvatarRichard R
Asked on Friday, July 11, 2014