22. case 21 An Oscillating Fan

22.1. Introduction

Build an oscillating fan with the micro:bit.


22.2. Quick Start

Materials Required

Nezha expansion board × 1

micro:bit × 1

360°servo × 1

Motor × 1

Bricks × n

Bricks details


Connection Diagram

  • Connect the servo to S1, motor to M1 and the micro:bit to Nezha expansion board.


Bricks Build-up

  • Build it as below

../../_images/case_21_04.png ../../_images/case_21_05.png ../../_images/case_21_06.png ../../_images/case_21_07.png ../../_images/case_21_08.png ../../_images/case_21_09.png ../../_images/case_21_10.png ../../_images/case_21_11.png


22.3. MakeCode Programming

Step 1

Click “Advanced” in the MakeCode drawer to see more choices.


We need to add a package for programming. Click “Extensions” in the bottom of the drawer and search with “nezha” in the dialogue box to download it.


Note: If you met a tip indicating that the codebase will be deleted due to incompatibility, you may continue as the tips say or build a new project in the menu.

Programme as the picture shows:



  • Turn on/off the fan by pressing button A/B.