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



BBC micro:bit  board x 1

OSOYOO RGB module x 1

OSOYOO 4-pin PnP cable x 1

OSOYOO Plug&Play( PnP ) board for micro:bit x 1



Connect RGB module to  OSOYOO PnP board  with a 4-pin PnP cable , make sure the pin connections must be exactly same as  following figure;

Step 0: Go to urlhttps://makecode.microbit.org, click New Project  

Step 1. In the Toolbox, click on the LED category and then drag a led enable false block  and   drop it inside the on start block

Step 2. Click on the Pins category ,drag an analog write pin block   and drop it below LED enable false block. set write  pin# to  P2,value to 1023 as following figure:

Step 3.  Right click analog write pin   block and use Duplicate method twice  . You will get two duplicated blocks ,and place them just below the first analog write pin block( still inside the on start block).
Set the pin# in two new blocks  to P1 and  P0 as following figure.


Step 4. Click on the Pins category.  Drag an analog write pin block and drop it inside the forever block ,and set the write value from 1023 to as following figure.

Step 5. In the Toolbox, click on the Basic category , drop a pause(ms) block drop it below analog write pin block(still  inside the forever block) .Set the pause (ms) to 1000 as following figure.

Step 6. Repeat duplicate method to make another five analog write pin blocks and  three   pause(ms) blocks .  Set the pin# and to value exactly same as following figure.

Step 7. In the Toolbox, click on the Loops category, drag a repeat times do block and place it below the last analog write pin P2 to 1023 block(inside the forever block). Set repeat times to 1 as following figure.

Step 8. Click on the Loops category.  Drag a for index from block and drop it inside the repeat times do block .
right click the red index oval and then select rename variable from drop-down menu to create “Val” as a new variable name, then click on the Ok button. replace the value to 513 as following figure.


Step 9. In the Toolbox, click on the Pins category.  Drag an analog write pin block  place it inside the for val from 0 to 513 block .

Step 10. Click on the Variables category and then click a Val block over , and then Drag and drop the Val block inside the analog write P0 to block as following figure.

Step 11. In the Toolbox, click on the Pins category again. Then click and drag the analog write pin block and drop it inside the for val from 0 to block .

Step 12. Click on the Math category and drag an 0-0 block and place it below analog write pin to Val block. Then set left value in 0-0 block to 1023  as below figure.
Step 13. Click on the Variables category , Drag and drop the Val block to replace 0 value in the 1023-0 block as following figure.

Step 14. Use duplicate method to make  another analog write pin P1 to 1023-Val block , drop this new block below original analog write pin P1 to 1023-Val block .  Then the new block set write pin# to p2 , replace 1023 with 512 as following figure.


Step 15: Click on the Basic category, drop a pause(ms) block and drop it below last analog write pin P2 to 512-Val  block(inside the for val from ), set the ms value to 1 as following figure.

Step 16. Repeat Step 8 to 15 and make another for Val from 0 to 513 loop block,place this new loop block just below the old   for Val from 0 to 513 loop block .  Change the pin# P0 and P1 ,P2 value and “to” statement  as per following figure.


Step 17: In the Toolbox, click on the Pins category.  Drag the analog write pin to block and place it below made-in-Step-16 Loop block(still inside the forever block) .set write pin# to P2 as following figure.

Step 18. Use duplicate method  to make another two analog write blocks .   place them below analog write block made in Step 17.  Then change the Pin to P1,P0 as following figure:
Step 19.Download this “.hex” file and save it to your MICROBIT disk Driver as following figure.

Below are the full Graphic programming code blocks  we have done for you as reference:

>





eted the experiment? In this way, you can also do more colorful lighting experiments.

Learn More about parts

No. Picture Product Name Link
1 BBC micro:bit micro Mainboard https://osoyoo.store/products/bbc-micro-bit-micro-controller-with-motion-detection-compass-led-display-and-bluetooth?variant=31021023002735
2 OSOYOO Expansion board for Micro:bit https://osoyoo.store/products/pnp-board-for-micro-bit-stem-kitmodel-2018005900?variant=31698997444719
3 Green LED Module https://osoyoo.store/products/green-led-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500?variant=31957968158831
4 Yellow LED Module https://osoyoo.store/products/yellow-led-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500
5 Red LED Module https://osoyoo.store/products/red-led-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500?variant=31957964882031
6 White LED Module https://osoyoo.store/products/white-led-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500?variant=31816681128047
7 Humi & Temp Module https://osoyoo.store/products/humi-temp-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500?variant=31957977563247
8 Passive buzzer Module https://osoyoo.store/products/passive-buzzer-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500
9 Flame sensor Module https://osoyoo.store/products/flame-sensor-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500
10 Red Button Module https://osoyoo.store/products/red-button-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500?variant=31958006693999
11 Yellow Button Module https://osoyoo.store/products/yellow-button-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500?variant=31958014328943
12 Photoresitor Module https://osoyoo.store/products/photoresitor-module-for-arduino-microbit-osoyoo-stem-kitmodel-2019011500?variant=31958061154415
13 RGB Module https://osoyoo.store/products/rgb-module-for-osoyoo-stem-kit-for-micro-bit-arduino-raspberry-pi-model-2019011500?variant=31958069739631
14 IR Receiver Module https://osoyoo.store/products/ir-receiver-module-for-arduino-raspberry-pi-micro-bit-stem-model-2019011500?variant=31958077309039
15 Infrared Remote Controller https://osoyoo.store/products/infrared-remote-controller-for-arduino-raspberry-pi-microbit-stemmodel-2019011500?variant=31958087532655
16 Microphone Module https://osoyoo.store/products/microphone-module-for-arduino-raspberry-pi-micro-bit-stem-model-2019011500?variant=31958089597039
17 Potentiometer Module https://osoyoo.store/products/potentiometer-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500?variant=31817102852207
18 Fan Motor module https://osoyoo.store/products/fan-motor-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500?variant=31957989359727
19 Micro Servo motor https://osoyoo.store/products/micro-servo-sg90-blue-for-arduino-v2-0-robot-carmodel-lacc200610
20 Ultrasonic detector module https://osoyoo.store/products/ultrasonic-detector-module-for-arduino-raspberry-pi-micro-bit-stemmodel-2019011500?variant=31958286729327
21 1602 I2C LED Screen https://osoyoo.store/products/white-led-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011501?variant=31817047048303
22 1 Channel Relay Module https://osoyoo.store/products/1-channel-relay-module-for-osoyoo-stem-kit-for-micro-bit-model-2019011500?variant=31957950562415