File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 26
26
UTC_OFFSET = os .getenv ("UTC_OFFSET" )
27
27
TZ = os .getenv ("TZ" )
28
28
29
- try :
30
- print (f"Connecting to { os .getenv ('CIRCUITPY_WIFI_SSID' )} " )
31
- wifi .radio .connect (
32
- os .getenv ("CIRCUITPY_WIFI_SSID" ), os .getenv ("CIRCUITPY_WIFI_PASSWORD" )
29
+ print (f"Connecting to { os .getenv ('CIRCUITPY_WIFI_SSID' )} " )
30
+ wifi .radio .connect (
31
+ os .getenv ("CIRCUITPY_WIFI_SSID" ), os .getenv ("CIRCUITPY_WIFI_PASSWORD" )
33
32
)
33
+ if wifi .radio .connected :
34
34
print (f"Connected to { os .getenv ('CIRCUITPY_WIFI_SSID' )} !" )
35
35
print ("My IP address is" , wifi .radio .ipv4_address )
36
36
pool = socketpool .SocketPool (wifi .radio )
44
44
ntp = adafruit_ntp .NTP (pool , server = "pool.ntp.org" , tz_offset = UTC_OFFSET // 3600 )
45
45
46
46
rtc .RTC ().datetime = ntp .datetime
47
- except Exception as e :
48
- print ("Wifi error:" , e )
49
- print ("Time not set" )
47
+ else :
48
+ print ("Wifi failed to connect. Time not set." )
50
49
51
50
pycam = adafruit_pycamera .PyCamera ()
52
51
# pycam.live_preview_mode()
You can’t perform that action at this time.
0 commit comments