README.rst
1.. zephyr:code-sample:: bbc_microbit_sound
2 :name: Sound
3 :relevant-api: pwm_interface
4
5 Use the piezo buzzer on the BBC micro:bit board.
6
7Overview
8********
9
10This sample demonstrates how to use a piezo buzzer connected
11to port P0 on the edge connector of the **BBC micro:bit v1** or
12using the on-board buzzer on the **BBC micro:bit v2**.
13
14Requirements
15************
16
17Using **BBC micro:bit v1**, a separate piezo buzzer must be connected to the board.
18One example is the MI:Power board that has a piezo buzzer in addition to a
19coin-cell battery. Resellers of this board can be fairly easily found using online search.
20
21The upgraded **BBC micro:bit v2** board does not need a separate buzzer as it has one
22built-in on the backside of the board (marked as 'speaker').
23
24
25Building and running
26********************
27
28The sample can be built as follows:
29
30Building for a BBC micro:bit v1
31-------------------------------
32
33.. zephyr-app-commands::
34 :zephyr-app: samples/boards/bbc/microbit/sound
35 :board: bbc_microbit
36 :goals: build flash
37 :compact:
38
39Building for a BBC micro:bit v2
40-------------------------------
41
42.. zephyr-app-commands::
43 :zephyr-app: samples/boards/bbc/microbit/sound
44 :board: bbc_microbit_v2
45 :goals: build flash
46 :compact:
47
48Sample Output
49=============
50
51This sample outputs sounds through a piezo buzzer based on
52button presses of the two main buttons. For each press the current
53output frequency will be printed on the 5x5 LED display.
54