src/eric7/MicroPython/Devices/MCUScripts/pimoroniWiFiConnect.py

branch
mpy_network
changeset 9890
66a6d3f131cc
parent 9836
902ec9a04ebe
equal deleted inserted replaced
9889:49728322ffb4 9890:66a6d3f131cc
1 try: 1 try:
2 import secrets 2 import secrets
3 3
4 def connectWiFi(): 4 def connect_wifi():
5 import picowireless as pw 5 import picowireless as pw
6 from time import sleep 6 from time import sleep
7 7
8 print("Connecting WiFi to '{0}' ...".format(secrets.WIFI_SSID)) 8 print("Connecting WiFi to '{0}' ...".format(secrets.WIFI_SSID))
9 pw.init() 9 pw.init()
23 print("WiFi connected:", '.'.join(str(i) for i in pw.get_ip_address())) 23 print("WiFi connected:", '.'.join(str(i) for i in pw.get_ip_address()))
24 else: 24 else:
25 pw.set_led(64, 0, 0) 25 pw.set_led(64, 0, 0)
26 print("WiFi connection failed") 26 print("WiFi connection failed")
27 27
28 connectWiFi() 28 connect_wifi()
29 except ImportError: 29 except ImportError:
30 print("WiFi secrets are kept in 'secrets.py', please add them there!") 30 print("WiFi secrets are kept in 'secrets.py', please add them there!")

eric ide

mercurial