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 https://makecode.microbit.org 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
DownLoad Url osoyoo.com