Connect servo motor with OSOYOO expansion board for Micro:bit P0 with 3pin wire as below;

Connect button module with OSOYOO expansion board for Micro:bit P1 with 3pin wire as below;


Step 1. In the Toolbox, click on the Logic category and then click the if-then-else block over , and place it inside the forever block .

Step 2. Drag and drop a 0=0 block inside the  if-then-else block, and  place it on the placeholder of the if-then-else block (by default, the placeholder has a true-false block). Then write 1 in it  as as below figure.

Step 3. In the Toolbox, click on the Pins category under Advanced. Now, click and drag the digital read pin P0 block over and place it inside the placeholder of the 0=0 block. Then choose P0 from the drop-down menu if it has not already been selected .

Step 4. Drag and drop a servo write pin to  block ,place it inside the “then” section of the if-then-else block. , and choose  100 from the drop-down menu .

Step 5. Click on the Basic category , click and drag the show leds  block over and place it inside of the if-then-else block just below the servo write pin to block.  Then click select a square coin on the squares as below figure.

Step 6. Drag and drop a pause(ms) block from Basic category over and place it inside the then block just below the show leds block , and change 100 to 1000.

Step 7. In the Toolbox, click on the Pins category, click and drag the servo write to  block over and place it inside of the else block. and choose  0 from the drop-down menu .

Step 8. Step 5. Click on the Basic category again , click and drag the show leds  block over and place it inside of the else block just below the servo write pin to block.  Then click select a “X” coin on the squares as below figure.

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: