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

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





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

sp_Feed sp_TopicIcon
ESP8288 - AT Command parsing and Escape Characters - Help with the Rules needed
No permission to create posts
February 7, 2017
3:08 pm
Avatar
Hafod
New Member
Members
Forum Posts: 2
Member Since:
February 6, 2017
sp_UserOfflineSmall Offline

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.

February 7, 2017
10:29 pm
Avatar
Vinod

MathWorks
Members
Forum Posts: 200
Member Since:
May 1, 2016
sp_UserOfflineSmall Offline

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.

February 8, 2017
11:52 am
Avatar
Hafod
New Member
Members
Forum Posts: 2
Member Since:
February 6, 2017
sp_UserOfflineSmall Offline

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:
19 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 261

Vinod: 196

piajola: 85

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

Newest Members:

celinabw2, FitoSprayscroma, LunnonGor, lancevl16, bernicenk60, veronicadq18

Administrators: Hans: 387, lee: 457