In the magnet challenge, I made a challenge using Microbit that behaved differently when a magnet is near the Microbit.
The Microbit showed different images when I press the buttons in the Microbit.
For this activity, I used supplies as following:
Microbit
Battery holder + 2x AAA Batteries
1x Magnet
1x USB Cable (To upload the code)
Also, I used Microsoft Makecode Software.
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.There are two choices for coding in Makecode, which are blocks and JavaScript. I chose block because it is easier to use.
Program the Microbit
Here was my code. You could change the image as you desire.Test the code
To test the code, I unplugged the USB cable from the computer. For Microbit to standalone, I plugged in battery holder with the battery inside it.Usually, the Microbit needs compass calibration.
Tilt the Microbit 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.
While I pressed button "B" (the right button), and the magnet was near, it showed a target image.
Then, I copied the file that I downloaded previously into the Microbit .
That is my entire project for magnet challenge. I hope you like it. Thank you very much for reading my tutorial.
Updated on 12/24/2020:
This project was mentioned in Adafruit blog and this link.
No comments:
Post a Comment
Please kindly give nice comment that can improve our website in the future.
Thank you.
Regards,
DIY4 Pro