@@ -42,14 +42,14 @@ const char* pass = SECRET_PWD;
42
42
43
43
// Note, MOSI (DataIn), Clk (SCK) are defaulted to D7 and D5, respectively on the 8266 I have
44
44
45
- void setup ()
46
- {
47
- // use only the WiFi 'station' mode
48
- WiFi.mode (WIFI_STA);
49
-
45
+ void setup () {
50
46
Serial.begin (115200 );
51
47
Serial.println (" Hello 4x7seg-flip-disc-clock-wifi" );
52
48
49
+ // We're going to blink the LED also, so we can tell that it's alive.
50
+ pinMode (LED_BUILTIN, OUTPUT);
51
+ digitalWrite (LED_BUILTIN, LOW); // turn the LED on (yes the logic is flopped)
52
+
53
53
/* Flip.Pin(); it is the most important function and first to call before everything else.
54
54
The function is used to declare pin functions. Before starting the device, double check
55
55
that the declarations and connection are correct. If the connection of the control outputs
@@ -75,6 +75,7 @@ void setup()
75
75
/* The function is used to test all declared displays - turn on and off all displays */
76
76
Flip.Test ();
77
77
delay (500 );
78
+ digitalWrite (LED_BUILTIN, HIGH); // turn the LED off (yes the logic is flopped)
78
79
79
80
// send credentials
80
81
WiFi.begin (ssid, pass);
@@ -108,9 +109,7 @@ void setup()
108
109
// register a callback (execute whenever an NTP update has occurred)
109
110
settimeofday_cb (timeUpdated);
110
111
111
- // We're going to blink the LED also, so we can tell that it's alive.
112
- pinMode (LED_BUILTIN, OUTPUT);
113
- digitalWrite (LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
112
+ digitalWrite (LED_BUILTIN, LOW);
114
113
}
115
114
116
115
int last_hour;
@@ -180,13 +179,10 @@ void loop() {
180
179
14 13 12 11 10 */
181
180
int sec = now->tm_sec ;
182
181
if (sec != last_sec) {
183
- // Flip one disc in the leftmost column to indicate 10s of seconds. I don't love this.
184
- for (int i = 0 ; i < sec / 10 ; i++) {
185
- Flip.Disc_7Seg (1 , 10 + i, 1 ); // last argument can be 0 to turn off
186
- }
187
- // for (int i = 0; i < 5; ++i) {
188
- // Flip.Disc_7Seg(1, 10 + i, (i + sec) % 2); // last argument can be 0 to turn off
189
- // }
182
+ // Flip one disc in bottom row to indicate 10s of seconds.
183
+ for (int i = 0 ; i < sec / 10 ; i++) {
184
+ Flip.Disc_7Seg (1 , 10 + i, 1 ); // last argument can be 0 to turn off
185
+ }
190
186
if ((sec % 2 ) == 0 ) {
191
187
digitalWrite (LED_BUILTIN, HIGH);
192
188
} else {
0 commit comments