ESP8288 - AT Command parsing and Escape Characters - Help with the Rules needed | ESP8266 Wi-Fi Module | Forum

Avatar

Please consider registering
Guest

Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

Register Lost password?
sp_Feed sp_TopicIcon
ESP8288 - AT Command parsing and Escape Characters - Help with the Rules needed
Avatar
Hafod
New Member
Forum Posts: 2
sp_UserOfflineSmall Offline
1
February 7, 2017 - 3:08 pm
sp_Permalink sp_Print

Hi

I am developing an application whereby two ESP8266's inter communicate using the TCP and I am using the ESP8266_TCP library to develop functions to Tx and Rx data between the TCP client and server ESP's. However, despite many hours looking at related posts on various forums I am still somewhat confused on how to parse the commands correctly, with or without string literals.  I am aware that I should use the backslash character '\' to precede double quotes INSIDE the overall string as shown.  So, example 1 I fully understand given this rule.

Example 1:

[code]

Write("AT+CWSAP=2,\"CG_BRST\",\"abcdefgh\");

[/code]

But this 'rule' doesn't seem to fully apply with the next two typical examples encountered by way way of Internet searching on the topic. Can anyone please enlighten me on parsing rules and using escape characters.

I assume ssid and password are string variables i the examples given.

Example 2

[code]

sendData("AT+CWJAP=\"" + ssid + "\",\"" +password + "\"");

[/code]

Example 3

[code]

write("AT+CWSAP=\"" + ssid +"\",\""+password+"\","+String(channel)+",4");

[/code]

Many thanks in anticipation of any help.

Avatar
Vinod

Forum Posts: 186
sp_UserOfflineSmall Offline
2
February 7, 2017 - 10:29 pm
sp_Permalink sp_Print

As a sanity check you may want to use some Serial.print(someString); statements. in your code and look in the Arduino IDE's serial monitor. For example the following code in an Arduino sketch

void setup() {
// put your setup code here, to run once:

}

void loop() {
// put your main code here, to run repeatedly:
String ssid = "Foo";
String password = "Bar";
String cmdString = "AT+CWJAP=\"" + ssid + "\",\"" + password + "\"" + "
";
Serial.print(cmdString);
delay(1000);
}

Shows me:

AT+CWJAP="Foo","Bar"

in the serial monitor. This is exactly what I expect.

If you are a beginner you may want to start with some tutorials on C programming.

Avatar
Hafod
New Member
Forum Posts: 2
sp_UserOfflineSmall Offline
3
February 8, 2017 - 11:52 am
sp_Permalink sp_Print

Thanks for your very helpful response Vinod and I will persue this straightforward approach with the Arduino IDE.  I'm sure I will encounter issues as I progress and will post them here for assistance if that's ok. 

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
17 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:

winnieeq69

AutoCheernpen

Bostermet

engladNed

iivenul

olewaeayafaku

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

 

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee