Petal Series Button Module
Product Overview
Used to detect button press actions.

Specifications
| Item | Illustration |
|---|---|
| Interface Type | HY2.0 4-pin Right-angle Header |
| Product Dimensions | 35.8 mm (L) × 23.8 mm (W) |
| Product Weight | 4.4 g (excluding packaging and accessories) |
Dimension Drawing

Hardware Wiring
Connect the Petal Series Button Module to the J1 port on the Petal Base Expansion Board.

Software Programming
Creating a New Project and Adding Extensions
Go to makecode.microbit.org and click New Project.

Enter a project name in the pop-up window and click Create.

Click Extensions in the code drawer.

Type petal in the pop-up interface and click the search icon. When the petal software library appears, select it.

Sample Program

Program Link: https://makecode.microbit.org/_YohMzRg2y0p7
You can also download the program directly via the embedded webpage below.
Downloading the Program
Connect your PC to the micro:bit V2 using a USB cable.

Once the connection is successful, your computer will detect a drive named MICROBIT.

Click the icon in the bottom-left corner
and select Connect Device.
Click
.
Click
.
In the pop-up window, select BBC micro:bit CMSIS-DAP and then click Connect. Your micro:bit is now successfully connected.

Click Download Program.

Results
When the button is pressed, the LED matrix displays a heart icon. When the button is released, the LED matrix displays a smiley face icon.