Last active
February 12, 2024 03:34
-
-
Save futechiot/ee0223dd269cbe7d8605ce97d120d7d2 to your computer and use it in GitHub Desktop.
ESP32 WIFI Modes Series: Create Hotspot on ESP32 in AccessPoint mode, Connect your ESP32 with your Home router or other wifi hotspot in STATION mode, make your ESP32 work in both mode simultaneously to give credentials and to send data on cloud
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
/* | |
OUTPUT: Creating your own hotspot on esp32 wifi+ble module. | |
Author: Ankit Rana (Futechiot) | |
Board Used: esp32 development board, LolinD32,WEMOS LOLIN32, ESP32 MH-ET live Minikit | |
Website: www.futechiot.com | |
GitHub: https://github.com/futechiot | |
*/ | |
#include <WiFi.h> //wifi library for ESp32 to access other functionalities | |
// Set these to your desired credentials. | |
const char *Apssid = "Anything you like"; //Give AccessPoint name whatever you like. (this will be Name of your esp32 HOTSPOT) | |
const char *Appassword = "123456789"; //Password of your Esp32's hotspot,(minimum length 8 required) | |
void setup() { | |
// put your setup code here, to run once: | |
Serial.begin(115200); // To enable Serial Commmunication with connected esp32 board | |
Serial.println(); | |
Serial.println("Configuring access point..."); | |
WiFi.mode(WIFI_AP); // Changing ESP32 wifi mode to AccessPoint | |
// You can remove the Appassword parameter if you want the hotspot to be open. | |
WiFi.softAP(Apssid, Appassword); //Starting AccessPoint on given credential | |
IPAddress myIP = WiFi.softAPIP(); //IP Address of our Esp8266 accesspoint(where we can host webpages, and see data) | |
Serial.print("AP IP address: "); | |
Serial.println(myIP); //Default IP is 192.168.4.1 | |
Serial.println("Scan For Wifi in your Mobile or laptop, you will see this network"); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
} |
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
/* | |
OUTPUT: Creating your own hotspot on esp32 wifi+ble module as well as | |
connect to your home router or mobile hotspot. | |
BOTH ACCESS POINT + STATION ACTIVATED | |
Author: Ankit Rana (Futechiot) | |
Board Used: esp32 development board, LolinD32,WEMOS LOLIN32, ESP32 MH-ET live Minikit | |
Website: www.futechiot.com | |
GitHub: https://github.com/futechiot | |
--> Download and Open this Application in Laptop | |
--> Scan for networks, make sure uour PC and Board are connnected in same network | |
--> Search for obtained IP, see in manufracturer "Espressif" | |
--> Scan for wifi in your mobile or laptop you eill see your hotspot name in scanned network | |
*/ | |
#include <WiFi.h> //Wifi library of Esp32 to access HARDWARRE APIS and othe functionality | |
/* Set these to your Wifi credentials. */ | |
const char*Wifi_ssid = "INCORE_AP_IoT"; // SSID of your Router OR mobile hotspot | |
const char*Wifi_password = "Welcome@Incore"; // PASSWORD of your Router or Mobile hotspot see below example | |
const char *Apssid = "WHAT EVER YOU LIKE"; //give Accesspoint SSID, your esp's hotspot name | |
const char *Appassword = "123456789"; //password of your esp's hotspot | |
void setup() { | |
// put your setup code here, to run once: | |
Serial.begin(115200); // to enable Serial Commmunication with connected Esp32 board | |
delay(500); | |
WiFi.mode(WIFI_AP_STA); // changing ESP9266 wifi mode to AP + STATION | |
WiFi.softAP(Apssid, Appassword); //Starting AccessPoint on given credential | |
IPAddress myIP = WiFi.softAPIP(); //IP Address of our Esp32 accesspoint(where we can host webpages, and see data) | |
Serial.print("Access Point IP address: "); | |
Serial.println(myIP); | |
Serial.println(""); | |
delay(1500); | |
Serial.println("connecting to Wifi:"); | |
Serial.println(Wifi_ssid); | |
WiFi.begin(Wifi_ssid, Wifi_password); // to tell Esp32 Where to connect and trying to connect | |
while (WiFi.status() != WL_CONNECTED) { // While loop for checking Internet Connected or not | |
delay(500); | |
Serial.print("."); | |
} | |
Serial.println(""); | |
Serial.println("WiFi connected"); | |
Serial.println("IP address: "); | |
Serial.println(WiFi.localIP()); // successful Connection of Esp32, | |
// printing Local IP given by your Router or Mobile Hotspot, | |
// Esp32 connect at this IP see in advanced Ip scanner | |
Serial.println(""); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
} |
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
/* | |
* ############################ DESCRIPTION ################################ | |
OUTCOME: Connecting your ESp32 to any Wifi NETWORK(Mobile Hotspot,Home Route) | |
Author: Ankit Rana (Futechiot) | |
Board Used: Esp32 Development Board, LoLinD32,WEMOS LOLIN32, ESP32 MH-ET live Minikit | |
Website: www.futechiot.com | |
GitHub: https://github.com/futechiot | |
Software: | |
Advanced IP Scanner: https://www.advanced-ip-scanner.com/ | |
-->download and open this application | |
-->Scan for networks, make sure your PC and board are connected in same network | |
-->search for obtained IP, see in manufracturer you will find "ESPRESSIF" | |
*/ | |
#include <WiFi.h> //Wifi library of ESP32 to access HARDWARRE APIS and othe functionality | |
/* Set these to your Wifi credentials. */ | |
const char* ssid = "INCORE_AP_IoT"; // SSID of your Router OR mobile hotspot | |
const char* password = "Welcome@Incore"; // PASSWORD of your Router or Mobile hotspot see below example | |
void setup() { | |
// put your setup code here, to run once: | |
Serial.begin(115200); // to enable Serial Commmunication with connected Esp32 board | |
delay(500); | |
WiFi.mode(WIFI_STA); // changing ESP32 wifi mode to STATION | |
Serial.println(""); | |
Serial.println(""); | |
Serial.println("connecting to :"); | |
Serial.println(ssid); | |
WiFi.begin(ssid, password); // to tell Esp32 Where to connect and trying to connect | |
while (WiFi.status() != WL_CONNECTED) { // While loop for checking wifi is Connected or not | |
delay(500); | |
Serial.print("."); | |
} | |
Serial.println(""); | |
Serial.println("WiFi connected"); | |
Serial.println("IP address: "); | |
Serial.println(WiFi.localIP()); // successful Connection of Esp32, | |
// printing Local IP given by your Router or Mobile Hotspot, | |
// Esp32 connect at this IP | |
Serial.println(""); | |
Serial.println("Download and Open Advanced IP scanner application given in above description to see board is connected (you can see Espressif.inc in manufracturer)"); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hallo, maaf sya ingin tau apakah bisa membuat robot dari esp 32 yg bisa dikendalikan jarak jauh dari manapun menggunakan jaringan internet
???