Step-by-Step Coding Tutorial
Let’s get ready to code your Bee Counter project. To follow the coding tutorial on Makecode, click the Start Coding button below.
Open Coding
If you’d like to try coding your Bee Counter without following a tutorial, you can code openly in the traditional Makecode workspace by clicking the link below.
Here’s a brief description to help you on your open coding journey:
Objective: Count number of pollinators that visit your monitoring station. Whenever a pollinator lands on the touch sensor the pixels of the LED Ring are turned on, and we increase the visitor count on the micro:bit LEDs by one.
Coding Description: The code initializes a variable to 0 and displays its value. A conditional statement is nested in a forever loop. This continually evaluations (checks) to see if a touch sensor is pressed. When the touch sensor is pressed, it increments the variable by one, sets all LEDs in an LED ring to red, displays the updated variable’s value, and then turns off the LEDs. Effectively, this code counts and displays the number of times the touch sensor is pressed, visually indicating each press on the LED ring by briefly turning it red and then off again.