Post your best Lua script examples here

User avatar
By Stevenelson
#14003 Any idea what I'm doing wrong?...

cfg={}
cfg.ssid="myAccessPoint"
cfg.password="password"

wifi.setmode(wifi.STATIONAP)
wifi.ap.config(cfg)

print(wifi.ap.getip())
print(wifi.ap.getbroadcast())
print(wifi.ap.getmac())

When I run this, it creates an access point, which I can connect to, but it doesn't set the ssid or the password. The ssid is always: ESP_A05210.

Is this a lua firmware bug or am i doing it worng?
User avatar
By Stevenelson
#14011 I figured it out. it's not cfg.password... it is cfg.pwd Here is the correct code:


cfg={}
cfg.ssid="myAccessPoint"
cfg.pwd="password"

wifi.setmode(wifi.STATIONAP)
wifi.ap.config(cfg)

print(wifi.ap.getip())
print(wifi.ap.getbroadcast())
print(wifi.ap.getmac())