[{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/000/661/original/Screenshot_2024-01-28_152037.png?1706480457","metadata":{"caption":""}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003cp\u003eHere is the first sketch: a simple clock.\u003c/p\u003e\n      \n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"code","content":"# SPDX-FileCopyrightText: Copyright (c) 2024 Randall Bohn (dexter)\n#\n# SPDX-License-Identifier: MIT\n#\n# EQUIPMENT\n## Adafruit Feather ESP32-S2 TFT\n## CircuitPython 9.0.0 or 8.2.9\n## FeatherWing Doubler https://www.adafruit.com/product/2890\nimport board\nimport displayio\nimport time\nfrom adafruit_bitmap_font.bitmap_font import load_font\nfrom adafruit_display_text.label import Label\nfrom adafruit_display_shapes.circle import Circle\nimport wifi\nfrom socketpool import SocketPool\nfrom adafruit_ntp import NTP\nimport rtc\n\ndisplay = board.DISPLAY\n\npool = SocketPool(wifi.radio)\nntp = NTP(pool, tz_offset=-7.0) # US/Denver\nrtc.RTC().datetime = ntp.datetime\n\ndef get_time():\n    now = time.localtime()\n    a = f\"{now.tm_year}-{now.tm_mon:02d}-{now.tm_mday:02d} \"\n    hour = now.tm_hour % 12\n    if hour == 0: hour = 12\n    b= f\"{hour:02d}:{now.tm_min:02d}:{now.tm_sec:02d}\"\n    return a,b\n\nradius = 24\nsplash = displayio.Group()\ncc = Circle(display.width*7//8, display.height//2, radius, outline=0xFFFFFF)\nsplash.append(cc)\nfont = load_font(\"/fonts/Arial-18.pcf\")\nclock = Label(font, text=\"----\",\n              color=0xFFFF66,\n              x=display.width//8,\n              y=display.height*7//8)\nsplash.append(clock)\ndisplay.root_group=splash\n\ndef loop():\n    clock.text = get_time()[1]\n    time.sleep(0.1)\n    \nif __name__==\"__main__\":\n    while True: \n        loop()","metadata":{"language":"python","linenums":false}},{"element_type":"text","content":"\n  \n        \u003cp\u003eI found the Arial-18 font here: \u003ca href=\"https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/main/MagTag/MagTag_Google_Calendar/fonts\"\u003eMagTag Google Calendar\u003c/a\u003e\u003c/p\u003e\n      \n","metadata":{}},{"element_type":"text","content":"\n        \u003cp\u003e\u003cspan\u003eThis script provides a simple digital clock display on the Feather ESP32-S2 TFT. The time is updated every 0.1 seconds, and the display shows a circle and the current time in a specified font. Built on the Desk of Distress.\u003c/span\u003e\u003c/p\u003e\n\u003ch2\u003e\u003cspan\u003eNext Steps:\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003e\u003cspan\u003eTemperature and Humidity (ADT7410)\u003c/span\u003e\u003c/p\u003e\n      ","metadata":{}}]