mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
examples: format all .ino files
This formats all the example source files using Arduino style rules.
This commit is contained in:
committed by
Ivan Grokhotkov
parent
e226251b27
commit
61cd8d8385
@ -10,44 +10,41 @@ String manageRequest(String request);
|
||||
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);
|
||||
Callback for when other nodes send you data
|
||||
|
||||
/* return a string to send back */
|
||||
char response[60];
|
||||
sprintf(response, "Hello world response #%d from Mesh_Node%d.", response_i++, ESP.getChipId());
|
||||
return response;
|
||||
@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 */
|
||||
char response[60];
|
||||
sprintf(response, "Hello world response #%d from Mesh_Node%d.", response_i++, ESP.getChipId());
|
||||
return response;
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
delay(10);
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
delay(10);
|
||||
|
||||
Serial.println();
|
||||
Serial.println();
|
||||
Serial.println("Setting up mesh node...");
|
||||
Serial.println();
|
||||
Serial.println();
|
||||
Serial.println("Setting up mesh node...");
|
||||
|
||||
/* Initialise the mesh node */
|
||||
mesh_node.begin();
|
||||
/* Initialise the mesh node */
|
||||
mesh_node.begin();
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
/* Accept any incoming connections */
|
||||
mesh_node.acceptRequest();
|
||||
void loop() {
|
||||
/* Accept any incoming connections */
|
||||
mesh_node.acceptRequest();
|
||||
|
||||
/* Scan for other nodes and send them a message */
|
||||
char request[60];
|
||||
sprintf(request, "Hello world request #%d from Mesh_Node%d.", request_i++, ESP.getChipId());
|
||||
mesh_node.attemptScan(request);
|
||||
delay(1000);
|
||||
/* Scan for other nodes and send them a message */
|
||||
char request[60];
|
||||
sprintf(request, "Hello world request #%d from Mesh_Node%d.", request_i++, ESP.getChipId());
|
||||
mesh_node.attemptScan(request);
|
||||
delay(1000);
|
||||
}
|
||||
|
Reference in New Issue
Block a user