In this project we'll take the NeoTrellisM4 and use it to make a dice roller.
We want to be able to select between 1 and 8 dice to roll, and the type of dice: 4, 6, 8, 10, 12, or 20 sided. To keep the interface simply, we can't mix types of dice.
The number of dice is selected using the top row of buttons: 1-8 starting from the left. As the count is selected, a bar fills in from the left.
The type of die is selected by buttons on the second row. Each type of die is assigned a unique color that is used to display the result of rolls as well as the associated selection button when a die is selected.
Button use and color is shown below.
Once the number and type of dice are selected, shaking the Trellis will roll the dice and display the result.
We'll be using CircuitPython for this project. Are you new to using CircuitPython? No worries, there is a full getting started guide here.
Adafruit suggests using the Mu editor to edit your code and have an interactive REPL in CircuitPython. You can learn about Mu and its installation in this tutorial.
There's a guide to get you up and running with CircuitPython specifically for the NeoTrellisM4. You should read it before starting to get the most recent CircuitPython build for the NeoTrellisM4 installed and running along with the required libraries.
Text editor powered by tinymce.