Click, click...
Now that you know a thing or two about CircuitBlocks, it's time for a bit more advanced sketch.
We'd like to write the instructions on the screen for you to follow.
The "fill frame with black" code will be used first.
After we took care of the background, it's time to write the instructions.
Please note that you can choose any background color you want.
Now, in the "Display" block section, look for the "write" block.
The directions, as you can see, are written in red and say "Press one of the top row buttons!".
To fit the display, we divided the sentence into two blocks.
To guarantee that the code executes properly, add the "push frame" block at the end of any "Display" code.
Let's now code what happens when we press and release the buttons.
To do that, find the "When button pressed" button from the I/O block section.
So, within the purple block, we want to write the code that we want to run only once when we push that button.
We want the screen to go black and to show which button has been pressed.
Don't forget to include the "push frame" block at the end, or your code will fail.
Let's make a copy of this I/O block.
Change left to right, and feel free to play with the coordinates.
Duplicate it once more for when you press enter.
We want the text to change to "Enter release" when we release the enter key.
That block can also be found in the I/O block section.
Finally, we'll add a press block for the back button.
When coding with the buttons, it's critical to include the "loops forever" and "scan buttons" blocks at the end to guarantee the buttons are always scanned and the code runs properly.
Click the Run button and start playing with the buttons.