Defining the bytes for each number
In the table below the bits are defined to get the hex/number value needed to light up the required segments (A – H) of the LED segment display:
The sources are available on GitHub to build and run this application which uses the LEDNumberDisplay Maven dependency I wrote about before:
Also included in the sources is a Python script which is copied to the tmp-directory on the Pi and then gets called whenever the selected bits change in the JavaFX application.
Here a little movie with the end result, sorry for the shaky breadboard recording, I should have used a tripod 😉
To setup the experiment you’ll need a lot of wires and a breadboard. The end result will look like the image below. To make things more clear, also a drawing with the same setup in a wiring diagram:
It’s a really fun experiment to go through this process of setting up the components on the breadboard, writing the Python script and building a JavaFX application on top of that.
Full info is part of “Chapter 8: Bits and bytes” in “Getting started with Java on the Raspberry Pi”.