Go Down

Topic: Octal character constants in NewSoftSerial.print? (Read 628 times) previous topic - next topic


I'm trying to send a string containing some control characters via a NewSoftSerial port. A snippet of my code looks like this:

    bbPort.print ( "\000\000\000\000\000\001Z00\002A0\033 t" );
    bbPort.print ( "Date: " );
    bbPort.print ( "\004" );

I see the string "Date: ", a bunch of stuff after that, and I see the \004 come through on the serial port I'm connected to. But I see none of the characters from the first line. What have I neglected?

Thanks for any help!


You're not going to be able to send null (zero) characters by including them in a C-like string.  The \000 will be interpretted as the end-of-string by the print function.


maybe try single quote send them as char?
- bbPort.print ( '\000' ); 
- bbPort.print ( '\004' ); 

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


<smacks forehead>

Thanks, guys! Working like a champ now.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131