Wink

Using the commands:
– forever,
– show leds,
– pause (ms),

create a program where the micro:bit displays a smiley face that winks its right eye every second using its LED lights.

Instructions for creating the program

1.

According to the task, the smiley face must wink continuously. From the Basic command group, select the forever block if it’s not already in the programming space. All commands placed within the forever block will execute continuously while the micro:bit is running.

2.

Within the forever block, place the show leds command to display the smiley face. Click on the squares to draw both eyes, the nose, and the mouth.

3.

Use the pause (ms) command to set the duration for which the smiley face with both eyes will be displayed. Set the display time for the smiley face to be 1 second, which equals 1000 milliseconds.

4.

Once again, place the show leds command followed by the pause (ms) command, but this time draw the smiley face with one eye for 200 milliseconds. This way, the smiley face will wink with one eye.

JavaScript code

In MakeCode editor you can create programs using block-based coding using a visual drag-and-drop interface or JavaScript coding that requires writing textual code.

Although your programs are created using Blocks, you’ll need to copy the JavaScript code of your created program for solving certain escape room tasks. After you create a program in MakeCode Blocks editor, you can see its JavaScript version by going to JavaScript mode.

Copy the JavaScript code from your Wink program and paste it into the box below:

This publication reflects the views only of the author, and the Commission cannot be held responsible for any use which may be made of the information contained therein.

Tags: