Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sending Esc character to Serial port
28-03-2014, 03:15 AM,
#1
Sending Esc character to Serial port
Hi All

I have a serial (9600 baud) LCD 16 x 2 which works by sending Esc character followed by QA for the first line or QB for the second line followed by the message to be displayed.

I couldn't find a way to send the Esc (dec 27) to the Serial using Serial.print ...
Any help would be appreciated.
Thanks
Reply
28-03-2014, 10:04 AM,
#2
RE: Sending Esc character to Serial port
(28-03-2014, 03:15 AM)mshalash Wrote: Hi All

I have a serial (9600 baud) LCD 16 x 2 which works by sending Esc character followed by QA for the first line or QB for the second line followed by the message to be displayed.

I couldn't find a way to send the Esc (dec 27) to the Serial using Serial.print ...
Any help would be appreciated.
Thanks

Hi,
You can try Serial.printf("\033"); // esc = 27 dec , 33 octal, 1B hexa
or Serial.printf("\x1B");
André
Reply
29-03-2014, 08:19 PM,
#3
RE: Sending Esc character to Serial port
Thanks Andre
I have solved it by
Serial.printf("%c",27);
before I read your message
however I tried your solution and it works as well

Cheers
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)