I'm a micropython newbie and I just started playing around on an ESP32 Cam (AIThinker)
The (very basic) code below works. The ESP connects to my wifi, I can access it and get the 'hello world' response from picoweb.
However, I would like to set it up as an access point, see the code commented out below. When I use this code, I have a password protected access point and I can connect my phone to the access point. But I get no response from 192.168.4.1:80
So how can I get picoweb to behave properly on an accesspoint ?
Thanks !
Code: Select all
import network
import picoweb
# =========================================================
# Connect to WiFi router
wifi = network.WLAN(network.STA_IF)
wifi.active(True)
wifi.connect('MySSID', 'MyPassword')
while not wifi.isconnected():
pass
# =========================================================
# Setup as access point
# wifi = network.WLAN(network.AP_IF)
# wifi.active(True)
# wifi.config(essid='esp32', authmode=3, password='12345678')
#
# while not wifi.active():
# pass
# =========================================================
print('ESP online @' + wifi.ifconfig()[0])
app = picoweb.WebApp(__name__)
@app.route('/')
def index(req, resp):
yield from picoweb.start_response(resp)
yield from resp.awrite('Hey hello there!')
app.run(debug=True, host=wifi.ifconfig()[0], port=80)