Skip to content

Add message count and the chip ID to the request/response messages in the mesh example. #1270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 22, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions libraries/ESP8266WiFiMesh/examples/HelloMesh/HelloMesh.ino
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMesh.h>

unsigned int request_i = 0;
unsigned int response_i = 0;

/* Create the mesh node object */
ESP8266WiFiMesh mesh_node = ESP8266WiFiMesh(ESP.getChipId(), manageRequest);

Expand All @@ -17,7 +20,9 @@ String manageRequest(String request)
Serial.println(request);

/* return a string to send back */
return String("Hello world response.");
char response[60];
sprintf(response, "Hello world response #%d from Mesh_Node%d.", response_i++, ESP.getChipId());
return response;
}

void setup()
Expand All @@ -39,6 +44,8 @@ void loop()
mesh_node.acceptRequest();

/* Scan for other nodes and send them a message */
mesh_node.attemptScan("Hello world request.");
char request[60];
sprintf(request, "Hello world request #%d from Mesh_Node%d.", request_i++, ESP.getChipId());
mesh_node.attemptScan(request);
delay(1000);
}