RaspberryPi dice project

Here’s a simple dice (ok, die) project for the Raspberry Pi SenseHAT – it senses a shake by measuring the G-force on the accelerometer. If the G-force goes above 1.4, it generates a random number between 1 and 6 and displays a dice (die) pattern. I chose 1.4 so it’s not too sensitive – you have to give it a decent shake, and I put in a small sleep statement so it doesn’t do multiple rolls in one go.

Hi Brittany – great idea for a project. You need to measure the tilt and adjust the x/y of the pixel accordingly. I thought I had a project like that but I don’t. Perhaps a game like this might give some ideas: https://www.youtube.com/watch?v=QmjHMzuWIqI