'Option wifi' within programs ?


Author Message
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3321
Posted: 01:07am 06 Jun 2025      

That looks like a good solution.
Below is what I have been using. It's adapted from the work of others here.
Sub MM.STARTUP
  Pause 200
  On error skip 6
  If MM.Info(ip address) = "0.0.0.0" Then    'test for WiFi link
    Print "WiFi not found";
    Pause 8000
    Print "...Rebooting now"
    CPU restart  'endless re-boot until WiFi found
  EndIf

  Local float TZ = 10, DS = 1    'Time Zone, Daylight Saving
  Local integer n = 0
  Do While Date$ = "01-01-2024" 'test internet connection, wait for date$ to update
   On error skip
    WEB NTP TZ+DS, "203.12.160.2" 'Second choice is 0.au.pool.ntp.org or 1.au.pool.ntp.org

   Inc n : Print n; " tries", DateTime$(now),
   Pause 2000
   If n=15 Then End Sub 'give up!
  Loop
  Print
  RUN 'start main program
End Sub