Build an app to help someone count objects. It could be used to count people going into a concert or the number of cars going down a street.
Create a blank project using the JavaScript Blocks Editor.
Go to microbit.org/code and click on Let's Code
In computer programming we use variables to store information. Variables are like boxes that can hold the information our program needs. It might be a number, a string (text, or something else. Programs can store variables and also change their contents.
Create this code to make a new variable that will hold the number of objects counted so far. It needs to be set to be 0 as soon as the program starts.
Tip: The unit can be renamed to count.
Add this code to your program to increase the count by one every time button A is pressed.
Think about why the forever loop is needed.
Use the 'Download' button to compile your code and download it onto your computer.
Upload the Hex file onto your micro:bit and test it out.