Now is the time to write simpler code.
This time, we'll learn how to switch the LEDs on the matrix on and off in loops with a one-second delay.
When the LEDs are turned on, the display turns white; when they are turned off, the display turns black.
Because we want this to happen in the loops all the time, first drag and drop the "loop forever" block onto the drawing area:
First, we want to make the display black, and the block for that is in the "Display" section.
Put the blocks that will turn off the LEDs on each matrix below that.
If the intensity is set to 0, the LEDs are turned off.
To ensure that the LEDs truly turn off, we must include "push frame to matrix" blocks for each matrix.
You must also include the "push frame" block from the "Display" block section to ensure that the display truly goes black.
Now, add a one-second delay between turning on and off the LEDs.
The next step is to make the display white and all of the LEDs turned on.
Remember to include the "push frame to matrix" and "push frame" blocks to ensure that these changes are visible.
Introduce another delay before the loop starts again.
Click on the Run button and check it out!