Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jacksonn455/fbd4a1e171b4c019f6e0091e06c83f69 to your computer and use it in GitHub Desktop.
Save jacksonn455/fbd4a1e171b4c019f6e0091e06c83f69 to your computer and use it in GitHub Desktop.
void setup(void){
pinMode(led, OUTPUT);
digitalWrite(led, 0); //led desligado
Serial.begin(115200); // serve para testar a conexao do monitor serial com velocidade 115200
WiFi.mode(WIFI_STA); // modo de conexao
WiFi.begin(ssid, password); // passa login e senha
Serial.println("");
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print("."); // se ficar o ponto, tem algum erro
}
Serial.println(""); // se parar o ponto ele conectou
Serial.print("Conectado em: ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
if (MDNS.begin("esp8266")) {
Serial.println("MDNS responder started");
}
server.on("/", handleRoot);
server.on("/inline", [](){ // deixa o servidor ligado
server.send(200, "text/plain", "this works as well");
});
server.onNotFound(handleNotFound);
server.begin(); // server ativo
Serial.println("Servidor iniciado");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment