From 05aed73bca1ed936ecde84dc2b67f91f5cc25d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sch=C3=BC=C3=9Fler?= Date: Mon, 21 Dec 2015 19:00:44 +0100 Subject: [PATCH] Send the message count and chip ID with the request/response. --- .../ESP8266WiFiMesh/examples/HelloMesh/HelloMesh.ino | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libraries/ESP8266WiFiMesh/examples/HelloMesh/HelloMesh.ino b/libraries/ESP8266WiFiMesh/examples/HelloMesh/HelloMesh.ino index 0423c20cf..492605bd0 100644 --- a/libraries/ESP8266WiFiMesh/examples/HelloMesh/HelloMesh.ino +++ b/libraries/ESP8266WiFiMesh/examples/HelloMesh/HelloMesh.ino @@ -1,6 +1,9 @@ #include #include +unsigned int request_i = 0; +unsigned int response_i = 0; + /* Create the mesh node object */ ESP8266WiFiMesh mesh_node = ESP8266WiFiMesh(ESP.getChipId(), manageRequest); @@ -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() @@ -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); }