0

I'm working on an RS485 project, In the CPP file there are const variables declared in the following manner:

#include <RS485_protocol.h>
const byte STX = '\2'; 
const byte ETX = '\3';

What does the '\2' and '\3' mean?

1

The '\2' and '\3' are characters with octal code 2 and 3. Which is nothing more then 2 and 3 in octal and in decimal. The author could simply write const byte STX = 2; const byte ETX = 3;.

Characters with ASCII code 2 and 3 are control characters STX (start of text) and ETX (end of text). Control characters are invisible characters used to control the terminal or as mark characters in communication.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.