Anny XuChristina ZhangRivenhogan96
Published © MIT

Future Board ESP32 IOT Watch Coding by Scratch (KittenBlock)

Turn the ESP32 based Future board into a watch with an astronaut spinning around on the dial plate.

BeginnerFull instructions provided1 hour1,582

Things used in this project

Hardware components

Future Board
KittenBot Future Board
comes with a USB-C cable
×1
Flash Memory Card, MicroSD Card
Flash Memory Card, MicroSD Card
any TF card will do
×1
USB Cable, USB Type C Plug
USB Cable, USB Type C Plug
any USB-C cable will do
×1
K-Watch
KittenBot K-Watch
You can choose to include a Future board
×1
ESP32S
Espressif ESP32S
If you don't have Future Board then you can also use ESP32S board to finish this project
×1

Software apps and online services

KittenBot Kittenblock

Story

Read more

Code

Code for the dial plate

Python
This is the code for the dial plate and showing the time. Do remember to change the wifi name and password into yours in line 7.
#/bin/python
from future import *
from sugar import *
from time import sleep
import ntptime
from machine import RTC
wifi.connect(str("Kittenbot"), "kittenbot428")
sleep(1)
ntptime.host="ntp.aliyun.com"
rtc = RTC()
ntptime.settime()

timestarty = 0
H1x = 0
M0x = 0
Dx = 0
H0x = 0
M1x = 0
timestartx = 0
taix = 0
taiy = 0
taidelay = 0

def time():
  global timestarty,H1x,M0x,Dx,H0x,M1x,timestartx,taix,taiy,taidelay
  timeH1 = (int(rtc.datetime()[int(4)] / 10))
  timeH0 = (rtc.datetime()[int(4)] % 10)
  timeM1 = (int(rtc.datetime()[int(5)] / 10))
  timeM0 = (rtc.datetime()[int(5)] % 10)
  timestartx = 40
  timestarty = 30
  H1x = (timestartx + 16 * 0)
  H0x = (timestartx + 16 * 1)
  Dx = (timestartx + 16 * 2)
  M1x = (timestartx + 16 * 3)
  M0x = (timestartx + 16 * 4)
  screen.loadPng(str(timeH1)+'.png',H1x,timestarty)
  screen.loadPng(str(timeH0)+'.png',H0x,timestarty)
  screen.loadPng('10.png',Dx,timestarty)
  screen.loadPng(str(timeM1)+'.png',M1x,timestarty)
  screen.loadPng(str(timeM0)+'.png',M0x,timestarty)


sleep(3)
screen.sync = 0
taix = 40
taiy = 50
taidelay = 0.1
screen.fill((255, 255, 255))
screen.loadPng('142.png',-8,0)


while True:

  screen.loadPng('142.png',-8,0)
  time()
  screen.loadPng('132.png',taix,taiy)
  screen.refresh()
  sleep(taidelay)
  screen.loadPng('143.png',taix + 13,taiy + 10)
  screen.loadPng('133.png',taix,taiy)
  screen.refresh()
  sleep(taidelay)
  screen.loadPng('143.png',taix + 13,taiy + 10)
  screen.loadPng('134.png',taix,taiy)
  screen.refresh()
  sleep(taidelay)
  screen.loadPng('143.png',taix + 13,taiy + 10)
  screen.loadPng('135.png',taix,taiy)
  screen.refresh()
  sleep(taidelay)
  screen.loadPng('143.png',taix + 13,taiy + 10)
  screen.loadPng('136.png',taix,taiy)
  screen.refresh()
  sleep(taidelay)
  screen.loadPng('143.png',taix + 13,taiy + 10)
  screen.loadPng('137.png',taix,taiy)
  screen.refresh()
  sleep(taidelay)
  screen.loadPng('143.png',taix + 13,taiy + 10)
  screen.loadPng('138.png',taix,taiy)
  screen.refresh()
  sleep(taidelay)
  screen.loadPng('143.png',taix + 13,taiy + 10)
  screen.loadPng('139.png',taix,taiy)
  screen.refresh()
  sleep(taidelay)
  screen.loadPng('143.png',taix + 13,taiy + 10)
  screen.loadPng('140.png',taix,taiy)
  screen.refresh()
  sleep(taidelay)
  screen.loadPng('143.png',taix + 13,taiy + 10)
  screen.loadPng('141.png',taix,taiy)
  screen.refresh()
  sleep(taidelay)
  screen.loadPng('143.png',taix + 13,taiy + 10) 

Credits

Anny Xu

Anny Xu

7 projects • 14 followers
Christina Zhang

Christina Zhang

20 projects • 31 followers
Founder of KittenBot
Riven

Riven

8 projects • 19 followers
hogan96

hogan96

5 projects • 6 followers
Thanks to CCFIVE, Hogan, Riven, and Anny Xu.

Comments