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 network | 5 import network |
6 import rp2 | 6 import rp2 |
7 from time import sleep | 7 from time import sleep |
8 | 8 |
9 country = secrets.WIFI_COUNTRY | 9 country = secrets.WIFI_COUNTRY |
24 if wifi.isconnected(): | 24 if wifi.isconnected(): |
25 print("WiFi connected:", wifi.ifconfig()) | 25 print("WiFi connected:", wifi.ifconfig()) |
26 else: | 26 else: |
27 print("WiFi connection failed") | 27 print("WiFi connection failed") |
28 | 28 |
29 connectWiFi() | 29 connect_wifi() |
30 except ImportError: | 30 except ImportError: |
31 print("WiFi secrets are kept in 'secrets.py', please add them there!") | 31 print("WiFi secrets are kept in 'secrets.py', please add them there!") |