I tried to assign a static IP address to my wipy. To do so, I have the following code (inspired by tutorial in docs):
Code: Select all
import machine
from network import WLAN
wlan = WLAN() # get current object, without changing the mode
if machine.reset_cause() != machine.SOFT_RESET:
wlan.init(WLAN.STA)
wlan.ifconfig(config=('192.168.0.20','255.255.255.0','0.0.0.0','127.0.1.1'))
if not wlan.isconnected():
wlan.connect('my_ssid', auth=(WLAN.WPA2, 'my_pass'), timeout=5000)
while not wlan.isconnected():
machine.idle()
Code: Select all
ifconfig
Code: Select all
ifconfig
Code: Select all
route -n
Code: Select all
cat /etc/resolv.conf
I was succesful in just connecting to my home router (the exercise before that in the docs). So the wlan.connect() line should work on its own.
I then connect to wifi set up by the wipy (still in acces point mode)
I saved above code in boot.py and uploaded that file to the ftp://192.168.1.1/flash/
Then I connect to my home wifi network and push the reset button on the wipy.
I then hoped to find the wipy as a station connected to my home access point, at ip 192.168.0.20. But no luck...
Does anyone have a clue what I'm doing wrong?
Thank you very much in advance!
Geert