Created
November 28, 2015 02:07
-
-
Save sabas1080/58cfe3aae0c0274454a7 to your computer and use it in GitHub Desktop.
Prueba para badge inventor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ESP8266WiFi.h> | |
#include <ESP8266WiFiMesh.h> | |
/* 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("Recibido"); | |
} | |
void setup() | |
{ | |
Serial.begin(115200); | |
delay(10); | |
Serial.println(); | |
Serial.println(); | |
Serial.println("Setting up mesh node..."); | |
/* Initialise the mesh node */ | |
mesh_node.begin(); | |
pinMode(5,INPUT_PULLUP); | |
} | |
void loop() | |
{ | |
/* Accept any incoming connections */ | |
mesh_node.acceptRequest(); | |
/* Scan for other nodes and send them a message */ | |
if(digitalRead(5)==0){ | |
Serial.println("Enviado comando"); | |
mesh_node.attemptScan("Comando LED"); | |
} | |
delay(100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment