2018-09-02 07:48:41 -04:00
|
|
|
"""Happy accidents or unplanned, fortunate discoveries."""
|
2018-09-02 07:17:36 -04:00
|
|
|
|
|
|
|
___name___ = "serendipity"
|
|
|
|
___license___ = "MIT"
|
2018-09-02 16:35:18 -04:00
|
|
|
___dependencies___ = ["sleep", "app", "ugfx_helper"]
|
2018-09-07 15:38:08 -04:00
|
|
|
___categories___ = ["Villages"]
|
2018-09-02 07:17:36 -04:00
|
|
|
|
2018-09-02 15:42:58 -04:00
|
|
|
import ugfx_helper, os, wifi, ugfx, http, time, sleep, app
|
2018-09-02 08:36:31 -04:00
|
|
|
from tilda import Buttons
|
2018-09-02 07:17:36 -04:00
|
|
|
|
|
|
|
# initialize screen
|
2018-09-02 15:42:58 -04:00
|
|
|
ugfx_helper.init()
|
|
|
|
ugfx.clear(ugfx.BLACK)
|
2018-09-02 07:17:36 -04:00
|
|
|
|
2018-09-02 16:35:18 -04:00
|
|
|
img = [ugfx.Image("serendipity/sun.png"),
|
|
|
|
ugfx.Image("serendipity/world.png")]
|
2018-09-02 15:42:58 -04:00
|
|
|
|
|
|
|
ugfx.backlight(100)
|
|
|
|
|
|
|
|
n = 0
|
2018-09-02 16:35:18 -04:00
|
|
|
ugfx.display_image( 0, 0, img[n] )
|
|
|
|
|
|
|
|
while True:
|
2018-09-02 15:42:58 -04:00
|
|
|
|
2018-09-02 16:35:18 -04:00
|
|
|
if Buttons.is_pressed(Buttons.BTN_B):
|
|
|
|
break
|
|
|
|
elif Buttons.is_pressed(Buttons.BTN_A):
|
|
|
|
n = (n+1) % 2
|
|
|
|
ugfx.display_image( 0, 0, img[n] )
|
2018-09-02 15:42:58 -04:00
|
|
|
|
|
|
|
ugfx.clear()
|
|
|
|
app.restart_to_default()
|