Muchika
Published

Both Mode ESP8266 (AP and Client Mode)

How to set the mode on ESP8266

BeginnerProtip2 hours2,996
Both Mode ESP8266 (AP and Client Mode)

Things used in this project

Hardware components

NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1
UTSOURCE Electronic Parts
UTSOURCE Electronic Parts
×1
Accsess point
×1

Story

Read more

Code

Both_mode.ino

Arduino
#include <ESP8266WiFi.h>

const char* APssid = "NodeMCU";
const char* APpassword = "1234567890";
const char* ssid = "Paris Nangisan";
const char* password = "11111111";

WiFiServer server(80);

void setup() {
  Serial.begin(115200);
  delay(10);
  
 // Mengatur WiFi ----------------------------------------------------------
  Serial.println();
  Serial.print("Configuring access point...");
  
  WiFi.mode(WIFI_AP_STA);
  WiFi.softAP(APssid, APpassword);
  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
   }
  
  Serial.println("");
  Serial.println("WiFi connected");
   
 // Start the server -------------------------------------------------------
  server.begin();
  Serial.println("Server dijalankan");
   
 // Print the IP address ---------------------------------------------------
  Serial.println(WiFi.localIP());
  Serial.println(WiFi.softAPIP());
}

void loop() {
  // put your main code here, to run repeatedly:

}

Credits

Muchika

Muchika

8 projects • 36 followers
share how to, diy, homemade, circuit design and new project ideas.

Comments