Creating Simulations: Coin Flipping With Micro:Bit #CodeBreaker

Creating Simulations: Coin Flipping With Micro:Bit #CodeBreaker

Screen Shot 2016-09-06 at 8.24.31 AM

Task: In this activity, students will create a working coin flipping simulator using the Micro:Bit (or online simulation).

Learning Goals:

• Compare experimental probabilities with the theoretical probability of an outcome involving independent events.
• Create simple algorithms that reflect computational thinking
• Create visual representations of problems and data
• Explore visual programming

Screen Shot 2016-09-06 at 9.27.30 AM

For more lessons, activities and ideas, grab a copy of my book, Code Breaker, on Amazon here!

Head over to in any web browser to get started. What makes this online tool so unique is that it works in the browser on all devices. You can even send source code from your phone or tablet via bluetooth to the Micro:Bit as seen below.

To begin the coin flipper simulator, you will want to determine the input used to trigger the code. I prefer the “On Shake” command to provide that unique tangible experience of flipping a coin. Next, you will want to create a variable. Give it a name and set it to “pick random 0 to 1” as seen below. At this point you have the opportunity to teach a mini-lesson about Boolean logic. George Boole was an English mathematician, educator, philosopher and logician. He worked in the fields of differential equations and algebraic logic, and is best known as the author of The Laws of Thought which contains Boolean algebra (source).

Screen Shot 2016-09-06 at 8.24.56 AM

As for the animation and structure of the “If Do Else” blocks, check out the full tutorial below.

Lastly, you can use the Micro:bit on any device. If you have a direct connection to a PC, you just need a micro USB cable. If you are connecting wirelessly from an iPad, you can pair via bluetooth. Here is an example done on an iPhone using Microsoft Block Code.

(Visited 1,390 times, 1 visits today)

One Response for this post

  1. Terence Carty
    Terence Carty
    | |

    Hey Brian
    Where can micro:bit’s be purchased? Are they available in Canada?


Leave a Reply

Email *