The new micro:bit version-2(V2) is packed with even more features and processing power. The Intro to Physical Computing with micro:bit course now covers content and project for both micro:bit versions 1 and 2. In this article, we cover:
- New features of microbit(V2)
- How to use MakeCode with microbit(V2)
- Working with MicroPython for microbit(V2)
What new features are there?
The new features include:
- Touch-sensitive logo
- A microphone
The easiest way to tell the difference between V1 and V2 is to look at the bottom edge. If it has notched edge, then it is version 2.
How do I use MakeCode with version-2?
MakeCode has new blocks to handle the new micro:bit features.
Visit this page to learn the details.
How do I know if the block is a version-2 block?
If you are looking for the version-2 blocks, click on the block category, then scroll down to the bottom. You’ll see ‘micro:bit(V2)’ showing the new blocks.
If your program uses any of the micro:bit v2 specific blocks, the simulator will automatically change to a micro:bit v2 with notches in the connector and a gold plated logo. You will also see a “v2” symbol on the lower right of the board.
MicroPython for micro:bit V2
MicroPython now has new modules to control the new features of the micro:bit version 2. Let’s learn how to work with them.
Visit the MicroPython documentation website.
Note that the new features – Microphone and Speaker has ‘V2’ in the menu.
Here’s a sample code that uses the microphone module:
from microbit import * display.clear() sound = microphone.current_event() while True: if button_a.is_pressed(): if microphone.current_event() == SoundEvent.LOUD: display.show(Image.SQUARE) elif microphone.current_event() == SoundEvent.QUIET: display.show(Image.SQUARE_SMALL) sleep(500) display.clear()
Can you tell what this code does?
When Button A is pressed AND when a loud or quiet sound *is* heard, display a large square image when loud, and a small square image when quiet.