Skip to content

Commit 28ef6af

Browse files
committed
Cleaned up formatting
1 parent b498cfe commit 28ef6af

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

4x7seg-flip-disc-clock/4x7seg-flip-disc-clock.ino

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ const char* pass = SECRET_PWD;
4242

4343
// Note, MOSI (DataIn), Clk (SCK) are defaulted to D7 and D5, respectively on the 8266 I have
4444

45-
void setup()
46-
{
47-
// use only the WiFi 'station' mode
48-
WiFi.mode(WIFI_STA);
49-
45+
void setup() {
5046
Serial.begin(115200);
5147
Serial.println("Hello 4x7seg-flip-disc-clock-wifi");
5248

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+
5353
/* Flip.Pin(); it is the most important function and first to call before everything else.
5454
The function is used to declare pin functions. Before starting the device, double check
5555
that the declarations and connection are correct. If the connection of the control outputs
@@ -75,6 +75,7 @@ void setup()
7575
/* The function is used to test all declared displays - turn on and off all displays */
7676
Flip.Test();
7777
delay(500);
78+
digitalWrite(LED_BUILTIN, HIGH); // turn the LED off (yes the logic is flopped)
7879

7980
// send credentials
8081
WiFi.begin(ssid, pass);
@@ -108,9 +109,7 @@ void setup()
108109
// register a callback (execute whenever an NTP update has occurred)
109110
settimeofday_cb(timeUpdated);
110111

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);
114113
}
115114

116115
int last_hour;
@@ -180,13 +179,10 @@ void loop() {
180179
14 13 12 11 10 */
181180
int sec = now->tm_sec;
182181
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+
}
190186
if ((sec % 2) == 0) {
191187
digitalWrite(LED_BUILTIN, HIGH);
192188
} else {

0 commit comments

Comments
 (0)