Buy from US Buy from UK Buy from DE Buy from IT Buy from FR Buy from ES ここでご購入を!

Step 0. Using your web browser, go directly to to land the MakeCode for micro:bit home page. You can bookmark this package to easily open this package for next project. In the My Projects section, click on the New Project

For more information about MakeCode, please go to our tutorial: What is MakeCode

Step 1. In the Toolbox, click on the Variables category and then click the Make a Variable button.

Step 2. In the New Variable name window, type “potentiometerval” as the variable name, then click on the Ok button.

Step 3. Drag and drop a set potentiometerval to 0 block inside the forever block.

Step 4. In the Toolbox, click on the Pins category under Advanced.

Step 5. Now, click and drag the analog read pin P0 block over and place it inside the placeholder of the set potentiometer to 0 block. Then choose P2 from the drop-down menu.

Step 6. Drag and drop a analog write pin P0 to 1023 block from Pins category over and place it inside forever block.

Step 7. Drag and drop potentiometerVal block from variable category   and place it inside the placeholder of the analog write pin to block

Step 8. rename the project b and download it

Step 9. Download this “.hex” file and send it to your MICROBIT disk.

Below is the full code we have done for you as reference:

Complete wiring and power up, and you can rotate the potentiometer to adjust the brightness of LED

Learn More about parts

No. Picture Product Name Link
1 BBC micro:bit micro Mainboard
2 OSOYOO Expansion board for Micro:bit
3 Green LED Module
4 Yellow LED Module
5 Red LED Module
6 White LED Module
7 Humi & Temp Module
8 Passive buzzer Module
9 Flame sensor Module
10 Red Button Module
11 Yellow Button Module
12 Photoresitor Module
13 RGB Module
14 IR Receiver Module
15 Infrared Remote Controller
16 Microphone Module
17 Potentiometer Module
18 Fan Motor module
19 Micro Servo motor
20 Ultrasonic detector module
21 1602 I2C LED Screen
22 1 Channel Relay Module