hn.today

Casio F-91W using Statecharts

github.com4 points0 comments
Screenshot of Casio F-91W using Statecharts

This project is an interactive model of the Casio F-91W wristwatch implemented with statecharts to demonstrate how hierarchical state machines govern watch behavior. It reproduces Alexis Philip’s digitized graphical elements and replaces the original logic with an XState machine, while showing states and transitions side-by-side using the Stately visualizer for educational purposes. The design deliberately echoes David Harel’s 1987 statecharts example of a digital wristwatch and provides an online demo to explore timekeeping, mode switching and setting flows with clear visual feedback of the underlying statechart.

The implementation mixes JavaScript and ClojureScript: demo/script holds rendering code, and src/casio contains machine.js, machine.cljs (machine actions), xstate_service.cljs, statecharts_service.cljs (a clj-statecharts wrapper), and app.cljs which runs the machine. Notable limitations include using the JavaScript Date object for date/time (day-of-week setting omitted), no continuous increment when holding the A button, and alarm time can be set but won’t actually trigger. Development uses Babashka (bb dev) to start a local server at http://localhost:8888/ with tests at /test. The project is MIT-licensed, lists resources (Citizen watch statechart, Harel’s paper, Casio manual), and has community signals such as 42 stars and a fork.

Read on github.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Other

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.