Introduction: Microbit Magnet
In the magnet challenge, I made a challenge using Micro:bit that behaved differently when a magnet is near the Micro:bit. The Micro:bit showed different images when I press the buttons in the Micro:bit.
For this activity, I used supplies as following:
Micro:bit Battery holder + 2x AAA Batteries
1x USB Cable (To upload the code)
Also, I used Microsoft Makecode Software. Here is the link: https://makecode.microbit.org/#
Step 1: Program Using Makecode Software
First, I opened the Makecode software. This is the page when
I created new project. Do not forget to rename the project.
Step 2: Program the Micro:bit
Here was my code. You could change the image as you desire.
I downloaded the code by clicking the download button and I connected the Micro:bit to the computer by plugging the USB Cable to the computer. Then, I copied the file that I downloaded previously into the Micro:bit.
Step 3: Test the Code
To test the code, I unplugged the USB cable from the computer.
For Micro:bit to standalone, I plugged in battery holder with the battery inside it.
Usually, the Micro:bit needs compass calibration. Tilt the Micro:bit to fill the screen. After that, test the code. When I pressed button "A" (the left button), and the magnet was far, it showed a cow image. While I pressed button "A" (the left button), and the magnet was near, it showed a giraffe image.
When I pressed button "B" (the right button), and the magnet was far, it showed a duck image. While I pressed button "B" (the right button), and the magnet was near, it showed a target image.
That is my entire project for magnet challenge. I hope you like it. Thank you very much for reading my instruction and do not forget, "Please vote for me".
Many thanks to BBC Micro:bit and Makecode.
For more project idea, visit DIY4 Pro.
Participated in the