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.
Each Friday is PiDay here at Adafruit! Be sure to check out our posts, tutorials and new Raspberry Pi related products. Adafruit has the largest and best selection of Raspberry Pi accessories and all the code & tutorials to get you up and running in no time!