Im trying now to send sms. please reffer to comment
Serial1.println("AT");
while (!Serial1.find("OK"));
Serial.println("OK");
Serial1.println("AT+CMGS=\"079169100\"");
while (!Serial1.find(">"));
Serial.println(">");
Serial1.println("my text my text\x1A");
Serial.println("send x1A"); //I get this message, its meaning we have sent text
while (!Serial1.find("OK"));
Serial.println("get OK"); //I didnt get OK, its meaning \x1A wasnt recognize as <^Z>
I know how to send ^Z with write() or with (char) casting but Im trying figure out how to send it by escape inside the println()
is it possible?
escape its mean escape symbol like "\r" and not ESC key
issue resolved. print() can escape \x1A I just forgot to setup AT+CSCS="GSM"
thank you
system
June 7, 2019, 7:12am
#5
lastchancename:
\r is Carriage Return ??
What did you think it was?
OP was describing it as ‘an escape character’...
system
June 7, 2019, 7:17am
#8
lastchancename:
\r is Carriage Return ??
Of course, but OPs pointing out that the \ escapes the next character so \r doesn't print a "" followed by an "r".
Probably be more correct of him to say:
escape sequence like "\r"
... but I'm sure most readers know what was meant.
This is very useful to know:
print() can escape \x1A
.
I've only ever used the \ as \r and \t etc, not to escape the actual hex code. So thanks for that OP.
system
June 7, 2019, 7:19am
#9
coffeeBean:
I’ve only ever used the \ as \r and \t etc, not to escape the actual hex code. So thanks for that OP.
You can also escape decimal and octal.
In fact, it is very hard to get far in C programming without using the former.
system
June 7, 2019, 8:01am
#12
alexblade:
no it is 0x1A
Correct...
1B is the ESC character ctrl-[, 1A is SUB, ctrl-Z.
system
June 7, 2019, 8:08am
#14
Not many ascii tables show the ctrl- equivalents; this one does .
AWOL, as I know decimal can't be escaped
system
June 7, 2019, 9:56am
#16
alexblade:
AWOL, as I know decimal can't be escaped
Really?
I use it all the time. char X = '\0';
in the print?
try print escaped decimal for example \32 inside the quotes print("\32"); I don't know how may be you know
system
June 7, 2019, 10:02am
#18
As an aside, and sorry to go ot a bit, is there a "definitive" list of the single character escapes \t \r etc?
(I have, of course, Googled, but there's no way to know if a list is complete )
system
June 7, 2019, 10:17am
#20
This line:
Serial.println("\x21\33");
... prints a ! for the x21 but a box for decimal equivalent 33.
So, seems it needs to be hex to print?