Raspberry Pi Pico W Access Point - cannot change default IP

Thanks for your reply @Doug27394, I have been through all the options and nil success.
Original reply deleted.

Conclusions I have come to:
DHCP assignment of IP addresses is flawed, connecting devices need to use static addresses.
The interface always starts up with 192.168.4.1 but can be changed and works with the change.
Setting of the SSID & Password must be done before activating the interface.
A small delay is necessary in starting and stopping the interface.
The previous IP address is remembered between program starts but not after power off.

Program code and shell output.

import time
import network
from SSID_AP import SSID_AP

IP =      '192.168.12.1'
SUBNET =  '255.255.255.0'
GATEWAY = '192.168.12.1'
DNS =     '0.0.0.0'

ssid = SSID_AP['ssid']
pw = SSID_AP['pw']

ap = network.WLAN(network.AP_IF)
ap.config(ssid=ssid, password=pw)
ap.active(True)
time.sleep(0.1)
print('1',ap)
ap.ifconfig((IP,SUBNET,GATEWAY,DNS))
time.sleep(0.1)
print('3',ap)

while True:
    pass
>>> %Run -c $EDITOR_CONTENT
1 <CYW43 AP up 192.168.4.1>
3 <CYW43 AP up 192.168.12.1>

Pings successful between Pico W, Phone, and Pi4B. Now for the next part of this project.

Cheers
Jim

2 Likes