Run file via MicroPython prompt
Posted: Wed Oct 19, 2016 8:40 am
I have a WiPy board (1.3) and i'd like to connect to my home network with it, so i could send data via socket to my home server without any internet connection. I have this board almost a year ago, but i have the freetime to use it just now. When i bought it i found some methods in the documentation that i could run any *py file. (For example "run myScript.py" or something like that) and i can't seem to find it anymore, not even the 1.3 documentation for WiPy. Here's my code for connecting to the router:
wlan = WLAN(mode=WLAN.STA)
# go for fixed IP settings
wlan.ifconfig(config=('dhcp'))
wlan.scan() # scan for available networks
wlan.connect(ssid='mySsid', auth=(WLAN.WPA2, 'somePassword'))
while not wlan.isconnected():
pass
I don't want to put the code into main.py or boot.py because i'm not always using the WiPy at home, and i can connect to it only with Wi-Fi, so it would be trouble some when i'm not at my home network.
PS: I'm new to the forum, nice to meet you all. Searched for this already, but couldn't really find anything, so i hope its okay to ask that.
wlan = WLAN(mode=WLAN.STA)
# go for fixed IP settings
wlan.ifconfig(config=('dhcp'))
wlan.scan() # scan for available networks
wlan.connect(ssid='mySsid', auth=(WLAN.WPA2, 'somePassword'))
while not wlan.isconnected():
pass
I don't want to put the code into main.py or boot.py because i'm not always using the WiPy at home, and i can connect to it only with Wi-Fi, so it would be trouble some when i'm not at my home network.
PS: I'm new to the forum, nice to meet you all. Searched for this already, but couldn't really find anything, so i hope its okay to ask that.
