Controlling the display

Controlling the display

Scrolling colors

We'll use this code to have the display light up in different colors every 500 ms. 

Before we begin, add the "begin nibble variant" block:

Firstly, use the "Loop forever" block from the "Loops" block section

Now, look for the "Fill frame with" block inside the "Display" block section, and place it inside the blue block.

We'll start with cyan, but you can choose whatever color you wish.

Now, under the "Time" block section, find the "sleep 0 ms" block and place it below the "Display" block. 

Instead of 0, enter 500. This indicates that it will take exactly 500 milliseconds for the display color to change.

Now, we'll go back to the "Display" block section and change the color of the display to green.

Add another time block below this one.

Repeat this step once more. 


Now, you can click on the Run button. 

Every 500 ms, the display will begin to change colors. 

Writing out some text

Now that we know how to change the background color, it's time to start writing something on that canvas.
Find the "Loop forever" block, and place the "Fill frame with" block within it. 

We'll use white to fill the frame.

After the display is filled with white, you'll try to code the filled circle on it. 

To do so, find this block and insert it beneath the first one. 

When you click on the filled, you'll find that you have the option of making a filled or outlined circle

You can also customize the circle's color.

We chose 30 for the radius and 35 for the x and y coordinates (where the circle will show on the screen). 

After this, we'll write something on the screen

To do that, find the "Write" block from the "Display" block section.

We'll put "CM" in yellow lettering at the coordinates x:10, y:10.

Duplicate the previous block, and do this with it:

Click on the Run button and check it out!

If you want to put the stock firmware back onto your device, you can click the Restore firmware button in the top right corner on CircuitBlocks.