You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-1Lines changed: 10 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2,4 +2,13 @@
2
2
3
3

4
4
5
-
Digital clock code with NTP sync for Arduino Nano 33 IoT and MAX7219 LED matrix
5
+
Digital clock code with NTP sync for Arduino Nano 33 IoT and MAX7219 LED matrix
6
+
7
+
## Connecting to settings page
8
+
9
+
* Grab a device (computer/phone/tablet) with WiFi connectivity.
10
+
* Hold **Select** for 5 seconds (or enter 'a' in the serial monitor).
11
+
* If the clock **is not** connected to WiFi, it will display `7777` and broadcast a WiFi access point called “Clock”. Connect your device to “Clock” and browse to [7.7.7.7](http://7.7.7.7).
12
+
* If the clock **is** connected to WiFi, it will flash its IP address (as a series of three 4-digit numbers). With your device on the same WiFi network, browse to that IP address.
13
+
* To disconnect the clock from WiFi, hold Select for 15 seconds; it will revert to the “Clock” access point.
14
+
* For security, the clock will stop serving the settings page (and “Clock” access point if applicable) after 2 minutes of inactivity.
Copy file name to clipboardExpand all lines: network-wifinina.cpp
+14-19Lines changed: 14 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,5 @@
1
1
//network-wifinina.cpp
2
2
3
-
/*
4
-
To access the admin menu:
5
-
6
-
Hold Select for 5 seconds. If you have already connected the clock to your WiFi network, it will flash its IP address (as a series of three 4-digit numbers), which you can now use to access the admin page.
7
-
8
-
If not, it will display a 4-digit number, and begin broadcasting a WiFi hotspot with that number (such as “Clock 1234”). Connect to this hotspot and browse to 192.168.1.1 to access the admin page – where, if you like, you can connect the clock to your WiFi network [which will discontinue the hotspot].
9
-
10
-
For security, the clock will stop serving the admin page (and hotspot if applicable) after 2 minutes of inactivity. To access it again, hold Select for 5 seconds as above. (It will stay connected to WiFi to continue requesting NTP syncs, weather forecasts, etc. I might add a password feature later, but I thought this physical limitation would be security enough for now.)
11
-
12
-
To change or forget the WiFi network the clock is connected to, use the admin page, or simply hold Select for 15 seconds (through the end of the IP address) to forget the network (the display will blink).
13
-
*/
14
-
15
3
#include"Arduino.h"
16
4
#include<SPI.h>
17
5
#include<WiFiNINA.h>
@@ -23,11 +11,12 @@ To change or forget the WiFi network the clock is connected to, use the admin pa
23
11
#include RTC_H //definitions for the RTC for calling the display
24
12
25
13
//#include "secrets.h" //supply your own
26
-
String ssid = "Riley";
14
+
String ssid = "Riley";//Stopping place: this should be empty and fillable via settings page. Then make it save in feeprom. Also ditch the fake rtc.
27
15
String pass = "5802301644";
28
16
//char ssid[] = SECRET_SSID; // your network SSID (name)
29
17
//char pass[] = SECRET_PASS; // your network password (use for WPA, or use as key for WEP)
30
18
int keyIndex = 0; // your network key Index number (needed only for WEP)
19
+
int WiFiEnabled = 0; //whether the customer wants to even use it TODO have this control the seconds display in part
31
20
32
21
unsignedint localPort = 2390; // local port to listen for UDP packets
33
22
IPAddress timeServer(129, 6, 15, 28); // time.nist.gov NTP server
@@ -65,6 +54,7 @@ void networkLoop(){
65
54
66
55
voidnetworkStartWiFi(){
67
56
WiFi.disconnect(); //if AP is going, stop it
57
+
if(ssid=="") return; //don't try to connect if there's no data
68
58
checkForWiFiStatusChange(); //just for serial logging
69
59
rtcDisplayTime(false); //display time without seconds
70
60
Serial.println(); Serial.print(millis()); Serial.print(F(" Attempting to connect to SSID: ")); Serial.println(ssid);
@@ -87,6 +77,7 @@ void networkStartAP(){
87
77
if(WiFi.beginAP("Clock")==WL_AP_LISTENING){ //Change "beginAP" if you want to create an WEP network
0 commit comments