Need to send a string of 50 NUL to wake up printer: cannot not seem to get right code- Any ideas?

for (int i=0; i<50; i++) { Serial.write(0); } //maybe?

It worked using Serial.print but didn't seem to like write. It woke up the printer which then went to sleep again! Very annoying!

Remember that null is not the same as ASCII zero.

0 ASCII= 48 decimal = 30 hex
null ASCII = 0 decimal = 00 hex

Serial.print(0); will print out an ASCII zero, not a null.
Serial.write(0); should get you a null character.

To be sure, you could try:

char MyNullCharacter=0x00;
for (int i=0;i<50;i++)

That way, you set the character equal to hex 00, which is null for sure.

@Richard you asked this also in another thread and thats called crossposting and some people don't like that as it costs double time For you to write the message, for us to read them, for you to collect answers etc. I added a message that the discussion is continued in this thread.

Wrt the question, where does the 50 nulls come from? Could you please place a copy of that manual page here? Maybe it need a few more bytes, a checksum, a certain baudrate ?

Hi rob & others, Fair point. New to forum etiquette! I put the question in the other location, then it occured to me that it was in the wrong place i.e. new topic.

I cannot copy the instruction but extract says: "To wake the printer by a data stream from the host, a certain period of logical "0" is required, typically a string of 50 NUL characters @ 9600 Baud is sufficient. These characters will be lost."

BKnight may have "hit the nail on the head". I think I sent Zeros rather than Nulls. The printer woke up, printed lots of 0, printed some junk and then went back to sleep. I will have a go with BKnights and report back. Thanks for your input.