Connect white LED module to OSOYOO PnP expansion board port P0 with 3-pin PnP wire as below.
Please pay attention:
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 Pins category under Advanced
Step 2. Drag and drop a digital write pin P0 to 0 block inside the forever block, and choose 1 from the drop-down menu. we can light up the LED with this program block.
Step 3. You can download this as “.hex” file and send it to your MICROBIT disk to see the code result.
Now let’s make the project more interesting and set a flashing LED.
Step 4. In the Toolbox, click on the Basic category, click and drag the pause (ms) block and place it inside of the forever block. You can set time of the PAUSE block as following:
Step 5. To simply the step, you can right click the digital write pin P0 to 1 block and duplicate a similar block. change the new block “to” value from 1 to 0. This block will turn off the LED.
Step 6. Go on and dupulicate pause (ms) block, you can set the same time as LED light on for LED off, and drag this block under digital write pin P0 to 0 block
Step 7. drop these two blocks again and place them inside the forever block.
The final blocks are as following figure:
Step 8. Give a name for your project and download the hex file as following:
Step 9. Send new project to your MICROBIT disk
Below is the full code of twinkling LED for you as reference:
Complete wiring and power up, You should see the LED flashing like a twinkling star.
DownLoad Url osoyoo.com