Local file system access while connected to the home router
will I have an access to a local file system on WiPy via FTP when WiPy will be connected to the home router?
@michalt38 to do this you need run Wipy in mode
but for me it can connect to router but i can not connect to it as AP.
But i do not tested this in the current firmware - maybe it work now
I do it in the same way like Robert. I have this section in my main.py--perhaps it is better in boot.py ?--to connect to the local WiFi
# # WiFi configuration # import machine from network import WLAN # configure the WLAN subsystem in station mode (the default is AP) wlan = WLAN(mode=WLAN.STA) # go for fixed IP settings (IP, Subnet, Gateway, DNS) #wlan.ifconfig(config=('192.168.0.107', '255.255.255.0', '192.168.0.1', '192.168.0.1')) wlan.scan() # scan for available networks wlan.connect(ssid='your_ssid', auth=(WLAN.WPA2, 'your_password')) while not wlan.isconnected(): pass print(wlan.ifconfig())
I did not configure a static IP, but after the first connection to the WiFi network I specified "use always the same IP" in the DHCP configuraion of my Fritz box router.
That's right. Here is the little script snippet I run on startup:
import network import time # setup as a station wlan = network.WLAN(mode=network.WLAN.STA) wlan.connect(ssid='my_ssid', auth=(network.WLAN.WPA2, 'my-passwd')) while not wlan.isconnected(): time.sleep_ms(50) wlan.ifconfig(config=("10.0.0.141", "255.255.255.0", "10.0.0.240", "192.168.44.66")) print(wlan.ifconfig())
That sets the IP to 10.0.0.141
How can I set the WiPy IP address? In this command: wlan.ifconfig(config=('192.168.0.4', '255.255.255.0', '192.168.0.1', '18.104.22.168')) the first address is a WiPy's IP?
That's how I configured my WiPy and LoPy. They run in STA mode, and either get their IP address from the router, or I set fixed addresses from the router's network. Using that IP address, I can access them with ftp. They act just as a server on your LAN.