micro:bit Microsoft Make Code (We use Python in here to code our Micro:bits!) REQUIRED
❤️Flashing Heart
(display)
micro:bit Microsoft Make Code (We use Python in here to code our Micro:bits!) REQUIRED
Hot Potato
(making random integers)
🎲 Dice
(If/Then/Else Loops)
Rock/Paper/Scissors (If/Then/Else Loops)
This is where it gets REALLY weird!!
Step Counter (Conditional Loops) - Blocks is the only Tutorial available. Austin P made a tutorial, or you can use the steps to the right =>
Step Counter
(Conditional Loops)
We need to measure your steps. We will measure 5 of them and enter your distance in my Spreadsheet.
We are going to tape your step counter to one of your legs. It will need to count 2 for every step by this leg because you're not counting the other leg, right? (The alternative is to hold and shake your micro:bit for every step you take, and then it will need to count only one step per shake)
We are going to walk the bus loop, which I'm told is 1/8 of a mile. We are going to test the accuracy of your step counter!
Go to micro:bit. https://makecode.microbit.org/#
Create a new project named "Step Counter."
Set the Language to Python.
Delete all of the current lines of code.
First, add a new variable that will control the Steps. To do this type: Steps = 0 in line 1, then press Enter.
Next type in line 2: input.on_gesture(Gesture.SHAKE, on_gesture_shake), then press Enter.
This should automatically create a function titled on_gesture_shake.
Delete "Pass" in line 3.
Make sure that the first line of the function is indented.
Type: "Global Steps" to grab the variable, then press Enter.
Go to the next line and type: Steps += 2, then press Enter. This will make sure your Steps are added everytime you step.
Then type in the next line type: basic.show_number(Steps), then press Enter.
Final Code should look like this:
Steps = 0
def on_gesture_shake():
global Steps
Steps += 2
basic.show_number(Steps)
input.on_gesture(Gesture.SHAKE, on_gesture_shake)
Got to the three dots next to the Download Button to open the download options.
Click Connect Device listed first on the downoad options.
A list of directions will be presented on the screen giving you directions on how to pair the micro:bit to your computer. The steps below can also help you with the pairing process.
Connect your micro:bit to your computer using a USB cable that goes from the micro:bit to the computer port.
Select Next.
Press the Pair button on the bottom right of micro:bit's instructions.
A window will appear, select your connected micro:bit device. Now click Pair.
When it finishes pairing, the program should hook up to your micro:bit automatically.
If an error occurs, make sure the micro:bit is plugged into your computer via USB. If errors continue, restart your computer or follow any more specific directions micro:bit may give you.
Now you have a functioning Step Counter. Every time you take a step with the micro:bit it will track the number of steps you have taken. It will display the number of steps on the micro:bit's led screen. To reset your steps press Reset located at the back of the micro:bit. In case the step counter is not working double check the code and repeat the pairing process.
micro:bit Microsoft Make Code (We use Python in here to code our Micro:bits!) REQUIRED:
micro:bit Microsoft Make Code (We use Python in here to code our Micro:bits!) REQUIRED:
Multi Dice- Blocks is the only Tutorial available. How can we make this a useful lesson? What other tutorials can ease us into Python that I can add below?
Multi-Dice
Future Tutorials