Today I’m here to solve one of the issues we face as we approach a cashless society. This is the inability to coin toss.I have considered many factors when creating this recipe and hope you enjoy your coinless coin tossing experience.
Check for flipping motion
Since the gyroscope sensors in the IMU block measure change in rotation it can be used to measure the flicking motion of a coin toss. By doing this you are able to physically stimulate the coin toss without the coin.
The values of the gyroscope range from -1M to 1M. By getting the absolute value using the parse gate and creating a threshold of 100000 we can trigger the coin toss with a rotation of the IMU block.
For the animation I made 8 images in the LED pattern maker to simulate the coin tossing. I think it adds an element of suspense that you would usually get watching a coin move through the air.
Randomly generate number
As with a coin toss, the outcome should be random, so I have used the random number generator to add some randomness to the coin tosser.
Select H or T
This is the step where we display the result. I have two patterns saved for the H and T, which i display depending on the random number generated.
I tried to draw a head to display for the H, but sadly it didn’t really look like a head with the low resolution that I had to work with.