I Try active wifi access point on esp32 with dip switch,
but odd, the wifi name and pass can't change as configure WiFi.softAP(ssid, password);
wifi name and pass still use program before
this my code
WiFiServer server(80);
bool hold_active_wifi=false;
const byte inset1 = 34;
const byte inset2 = 35;
const char* ssid = "kwh_jimmi";
const char* password = "123456";
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(inset1, INPUT);
pinMode(inset2, INPUT);
if(digitalRead(inset1) == ON){
if(hold_active_wifi == false){
active_wifi();
hold_active_wifi = true;
}
while(1){
if(digitalRead(inset1) == OFF){
ESP.restart();
}
WiFiClient client = server.available();
}
}
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(inset1) == ON){
ESP.restart();
}
Serial.println("aplikasi running...");
delay(1000);
}
void active_wifi(){
Serial.println("active wifi...");
WiFi.softAP(ssid, password);
IPAddress IP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(IP);
server.begin();
}
This site is for issues with the arduino-esp32 code, not your logic. If you cut this to just the code in active_wifi(), does it start the AP with the correct credentials?
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
@jimmisitepu88 make your password atleast 8 character long. It will work.
[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.
Most helpful comment
@jimmisitepu88 make your password atleast 8 character long. It will work.