Skip to content

Commit 42b0606

Browse files
asterix24danieledapo
authored andcommitted
ports: esp32: otto: Show data when press button
1 parent b2cec2e commit 42b0606

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

ports/esp32/modules/otto.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,6 @@ def welcome(display):
6161
display.fill(0)
6262
display.show()
6363

64-
def show_clock(display):
65-
display.fill(0)
66-
year, month, day, hour, minute, second, _, _ = utime.localtime()
67-
display.text("%s/%s/%s" % (day, month, year), 20, 10)
68-
display.text("%s:%s:%s" % (hour, minute, second), 20, 30)
69-
display.show()
70-
utime.sleep_ms(5000)
7164

7265
def viber():
7366
for i in range(3):
@@ -78,19 +71,28 @@ def viber():
7871

7972
display = None
8073
flag = False
74+
bounce = 0
8175
def buttonPressed(b):
8276
print("Pressed %s" % b)
77+
global bounce
8378
global flag
79+
8480
if flag:
8581
display.blit(icons.logo, 0, 0)
8682
display.show()
87-
utime.sleep_ms(1000)
88-
show_clock(display)
89-
flag = not flag
83+
utime.sleep_ms(300)
84+
85+
display.fill(0)
86+
year, month, day, hour, minute, second, _, _ = utime.localtime()
87+
display.text("%s/%s/%s" % (day, month, year), 20, 10)
88+
display.text("%s:%s:%s" % (hour, minute, second), 20, 30)
89+
display.show()
9090
else:
9191
display.fill(0)
9292
display.show()
9393

94+
flag = not flag
95+
9496
def run():
9597
if settings.DEBUG_HOST:
9698
debug_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy