# mPy - Activate Esp32 WiFi Access-Point
# Copyright by Anthony Vogelaar, Perth Scotland
# rev 0.10  2025-11-25  initial release

import	network

# ======================= global ==========================

# Activate WiFi access-point on 192.168.4.1
def startWifiAP(ssid='Esp32_AP', passwd='12345678'):
    network.WLAN(network.STA_IF).active(False)
    ap = network.WLAN(network.AP_IF)
    ap.active(False)
    ap.active(True)
    ap.config(essid=ssid, password=passwd, authmode=network.AUTH_WPA2_PSK)
    print(f'WiFi AP {ssid}:{passwd} started on 192.168.4.1') 

# ========================= test ===========================

if __name__ == '__main__':
    
    startWifiAP()
    
# ========================= end ============================
