dundalek / casio-f91w-fsm

Interactive model of the Casio F-91W watch using statecharts

Home Page:https://casio-f91w.pages.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Casio F-91W using Statecharts

Online demo here: casio-f91w.pages.dev

Interactive model of the Casio F-91W watch using statecharts.

Intro

Statecharts are an extension of state machines, introduced by David Harel in 1987. In the paper, Harel used a digital wristwatch as an example model.

I always thought it would be great to have an interactive demo that allows to see statecharts in action. Unfortunately, that particular wristwatch (Citizen Quartz Multi-Alarm III) is now a rarity.

However, there is the iconic Casio F-91W, which despite being introduced only two years after the paper was published, remains widely popular and is still manufactured and sold today. Alexis Philip created an online version digitizing the graphical elements.

This demo builds on Alexis' work, demonstrates using statecharts by replacing the logic using the XState library, and uses the Stately visualizer to show states and transitions side by side for educational purposes. You can also check out the official manual official manual for the watch.

Casio F-91W Statecharts Demo

Differences & limitations

  • Setting date and time is slightly different since it is represented using the builtin JavaScript Date object. Setting the day of week is therefore not used in the demo.
  • Holding A button to continue incrementing time in alarm or date time setting is not implemented.
  • You can set daily alarm time, but actual triggering the alarm is not implemented.

Implementation

File structure:

Development

Run bb dev to start the dev process (requires Babashka)

Open the app: http://localhost:8888/
Run tests in browser: http://localhost:8888/test

About

Interactive model of the Casio F-91W watch using statecharts

https://casio-f91w.pages.dev

License:MIT License


Languages

Language:Clojure 70.5%Language:JavaScript 29.5%