Guide

3/7/2018 SparkFun Inventor's Kit for micro:bit Experiment Guide - learn.sparkfun.com
https://learn.sparkfun.com/tutorials/sparkfun-inventors-kit-for-microbit-experiment-guide/all#introduction-to-microsoft-makecode 37/63
Finally, inside of the forever block is a more complex if block, which is an if / if else / else tree. To build this more
complex “if” statement, add a standard if / else block into your program. Then click on this small gear in the upper left-hand
corner of the block. This will open a tiny interface with more blocks in it. You can drag more else if blocks into the structure
here to build your decision tree. Here is what ours looks like:
Once you are done rearranging your “if” statement you can close this menu by clicking on the gear again.
What You Should See
When you press the button, the RGB will turn on to a color. When you press it again, the color will change and another press will
change the color once again. Press it one more time, and it will turn off. Every time you press the button, it increments a variable,
and then we check against it to set the color. If the variable goes over the value of 2, we reset it to 0, which is off.
While the image shows a black momentary pushbutton, you can use any colored button as long as it is momentary pushbutton to
cycle through the colors!
Troubleshooting