-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode.ino
43 lines (38 loc) · 977 Bytes
/
code.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# NodeMcuV3_mesh
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMesh.h>
String manageRequest(String request);
/* Create the mesh node object */
ESP8266WiFiMesh mesh_node = ESP8266WiFiMesh(ESP.getChipId(), manageRequest);
/**
* Callback for when other nodes send you data
*
* @request The string received from another node in the mesh
* @returns The string to send back to the other node
*/
String manageRequest(String request)
{
// Print out received message
Serial.print("received: ");
Serial.println(request);
// return a string to send back
return String("Hello world response1.");
}
void setup()
{
Serial.begin(115200);
delay(10);
Serial.println();
Serial.println();
Serial.println("Setting up mesh node...");
/* Initialise the mesh node */
mesh_node.begin();
}
void loop()
{
/* Accept any incoming connections */
mesh_node.acceptRequest();
/* Scan for other nodes and send them a message */
//mesh_node.attemptScan("Hello Tyler.");
delay(10);
}