Connect RGB module with OSOYOO expansion board for Micro:bit P0,P1,P2 and negative electrode with 4pin wire as below;

Step 1. In the Toolbox, click on the  LED category and then click a led enable falsh block over , and then Drag and drop the led enable falsh block inside the on start  block

Step 2. Click on the pins category and then click the analog write pin to block over , and then choose P2 from the drop-down menu.

Step 3. Two times click Duplicated from the analog write pin to block over . You will get two duplicated blocks ,and place it inside the on Start block .change the P2 to P1 and P0.

Step 4. Click on the pins category. Then click and drag the analog write pin to block over, and place it inside the forever block ,and changed the 1023 to 0.

Step 5.  In the Toolbox, click on the  BASIC category and then click a PAUSE (MS) block over , and then Drag and drop the PAUSE (MS) block inside the FOREVER block.

Step 6.  More times click duplicated from the analog write pin to block over and PAUSE (MS) block over . You will get more duplicated blocks ,and place them  inside the  forever block .change the P0 to P1 and P2 ,change the 0 to 1023,according below figure.

Step 7. In the Toolbox, click on the loops category, click and drag the repeat times do block over and place it inside of the forever block. repeat times changed to 1 .

Step 8. Click on the loops  category. Then click and drag the for index from 0 to  block over,  place it inside the repeat times do block .And choose rename variable from the drop-down menu to create “Val” as a new variable name,then click on the Ok button.Changed the number 4 to 513.

Step 9. In the Toolbox, click on the pins category. Then click and drag the analog write pin to block over and place it inside the for val from 0 to 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.

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

Step 12. Click on the Math category and drag and drop the 0-0 block over and place it inside the analog write pin to block. Then changed to  1023-0 in it .
Step 13. Click on the  Variables  category and then click a Val block over , and then Drag and drop the Val block inside the 1023-0 block.

Step 14. Click duplicate from the analog write pin to block over . You will get a duplicated block ,and place it inside the on for val from 0 to block .changed the P1 to p2 ,the number 1023 to 512.

Step 15.Click on the  BASIC category and then click a PAUSE (MS) block over , and then Drag and drop the PAUSE (MS) block inside the for val from 0 to block,changed the ms 100 to 1.

Step 16.According for val from 0 to 513 program,writed a new for val from 0 to 513 program. Changed the P0 and P1 ,P2 val as below figure.

Step 17.In the Toolbox, click on the pins category. Then click and drag the analog write pin to block over and place it inside the forever  block .changed the P0 to P2 .

Step 18.Two times click duplicate from the analog write pin to block over . You will get two duplicated blocks ,and place it inside the forever block .changed the P2 to P1,P0.
Step 19.Download this “.hex” file and send it to your MICROBIT disk.

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

>