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.

Parts

Hands pressing buttons on lit up NeoTrellis M4
So you've got a cool/witty name for your band, a Soundcloud account, a 3D-printed Daft Punk...
$59.95
In Stock
USB cable - USB A to Micro-B - 3 foot long
This here is your standard A to micro-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Metro, Feather, Raspberry Pi or other dev-board or...
$2.95
In Stock

This guide was first published on Nov 18, 2018. It was last updated on Mar 15, 2024.

This page (Overview) was last updated on Mar 08, 2024.

Text editor powered by tinymce.