Octal character constants in NewSoftSerial.print?

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!
--Tom

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' );

Doh!

Thanks, guys! Working like a champ now.

Hey, are you using a betabrite sign? I'm trying to specifiy the color of the text, any ideas?