Need help with wifi connection of ESP 8266-01

Hi guys, I'm almost done this project:
DIY IoT Based Smart Key Finder using ESP8266. After done programming the ESP 01, it cannot connect to my hotspot or my Wifi. Then I have google every where but I can't find the answer. Can you guys help me please???

#include <ESP8266WiFi.h>
 
#include <WiFiClient.h> 

#include <ESP8266WebServer.h> 
      
ESP8266WebServer server(80);   

const int buz_pin = 2;

char ssid[] = "duocdima";

char pass[] = "123";

String html_code = "<!DOCTYPE html><html><head><style>.button {border: none;padding: 12px 40px;text-align: center;text-decoration: non`Văn bản định dạng trước`e;display: inline-block;font-size: 16px;margin: 4px 2px;cursor: pointer;}.button1 {background-color: black; color: white; border: 3px solid #1c1c1b;border-radius: 30px}body {text-align: center;}</style></head><body><h2>IoT Based Keychain</h2><p>Press the Button to Turn On/Off the Buzzer</p><form action=\"/BUZ\" method=\"POST\"><button class=\"button button1\">Click Me!</button></form>";

boolean buzzing_state = false;

void handleRoot() { 

server.send(200, "text/html", html_code + "Current state: <b>" + buzzing_state);

}

void handleBUZ() { 

buzzing_state = !buzzing_state; 

server.sendHeader("Location","/"); 

server.send(303); 

}

void handleNotFound(){

server.send(404, "text/plain", "404: Not found"); 

}

void setup(void){ 

  Serial.begin(115200);        

  delay(10);

  pinMode(buz_pin, OUTPUT); 

  Serial.print("\n\nConnecting Wifi... ");
  WiFi.begin(ssid, pass);

  while (WiFi.status() != WL_CONNECTED)

  {    

    delay(500);

  }

  Serial.println("OK!");

  Serial.print("IP address: ");

  Serial.println(WiFi.localIP());           

  Serial.println();

  server.on("/", HTTP_GET, handleRoot);     

  server.on("/BUZ", HTTP_POST, handleBUZ);  

  server.onNotFound(handleNotFound);        

  server.begin();                           

  Serial.println("HTTP server started\n");

}

void loop(void){ 

  server.handleClient();                    

  if (buzzing_state == true) {

    digitalWrite(buz_pin, HIGH);

    delay(400);

    yield();

    digitalWrite(buz_pin, LOW);

    delay(200);

    yield();

    delay(400);

    yield();

  }

}

> Trích dẫn

Welcome to the forum

Your topic was MOVED to its current forum category as it is more suitable than the original

Please post your full sketch, using code tags when you do

Oh I didn't know that, thanks man.
BTW can you help me with this please?? Cause my deadline is very short.

https://www.google.de/search?q=arduino+ESP8266+connect+to+router+democode

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.