Skip to content

Commit 94d1b73

Browse files
visualize corresponding code snippets
1 parent 0099693 commit 94d1b73

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,42 @@ Flash your Pico with [MicroPython](https://www.raspberrypi.com/documentation/mic
1818

1919
Enter your WiFi credentials in the [`lib/env.py`](https://github.com/StackOverflowIsBetterThanAnyAI/pico-w-clock-oled-display/blob/main/lib/env.py) file.
2020

21+
```
22+
SSID = "SSID"
23+
PASSWORD = "WIFI_PASSWORD"
24+
```
25+
26+
<br/>
27+
2128
As soon as the `Pico` is plugged in, it connects to the specified WiFi Access Point.
2229

2330
Then, it fetches the current time from an open API, disconnects from the WiFi and updates the time every second.
2431

2532
The default time zone is equal to Europe/Berlin, but it can easily be changed in the [`initialize_time.py`](https://github.com/StackOverflowIsBetterThanAnyAI/pico-w-clock-oled-display/blob/main/initialize_time.py) file by referring to [the official docs](https://timeapi.io/swagger/index.html).
2633

34+
```
35+
response = urequests.get("https://timeapi.io/api/time/current/zone?timeZone=Europe%2FBerlin")
36+
```
37+
38+
<br/>
39+
2740
The default time format is `hh:mm:ss`, and the corresponding date format is `DD.MM.YYYY`, which can be modified in the [`display.py`](https://github.com/StackOverflowIsBetterThanAnyAI/pico-w-clock-oled-display/blob/main/display.py) file.
2841

42+
```
43+
time_string = f"{hour:02}:{minute:02}:{second:02}"
44+
date_string = f"{day:02}.{month:02}.{year}"
45+
```
46+
47+
<br/>
48+
2949
Every new day at 00:00:00 (can be edited in the [`main.py`](https://github.com/StackOverflowIsBetterThanAnyAI/pico-w-clock-oled-display/blob/main/main.py) file), the time is synchronized again by reconnecting to the Access Point, if it is available.
3050

51+
```
52+
if current_hour == 0 and current_minute == 0 and current_second == 0:
53+
```
54+
55+
<br/>
56+
3157
By pressing `KEY0`, the program is restarted, pressing `KEY1` leads to clearing the screen. The content reappears after pressing `KEY1` once again.
3258

3359
Holding down `KEY0` for five seconds will shutdown the `Pico` safely.

0 commit comments

Comments
 (0)