Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ESP8266WiFi.h>
- #include <ESP8266WebServer.h>
- const char* ssid = "OBEC27"; // Access point name
- const char* password = "12345678"; // Access point password
- ESP8266WebServer server(80);
- void setup() {
- Serial.begin(9600);
- // Connect to WiFi network
- Serial.println();
- Serial.print("Connecting to ");
- Serial.println(ssid);
- WiFi.begin(ssid, password);
- while (WiFi.status() != WL_CONNECTED) {
- delay(500);
- Serial.print(".");
- }
- Serial.println("");
- Serial.println("WiFi connected");
- // Print the IP address
- Serial.println(WiFi.localIP());
- server.on("/", displayHomePage);
- server.begin();
- Serial.println("HTTP server started!");
- }
- void loop() {
- server.handleClient();
- }
- void displayHomePage(){
- server.send(200, "text/html", "<h1>Hello. Welcome to my Home</h1>");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement