ERSTE SCHRITTE: DAS 5X5 LED RASTER

Introduction

Options within a program can be made dependent not only on inputs, but also on other conditions. For example, you can create an oracle that randomly shows a sad or a happy smiley:

Step 1

If – then do relationship

The actions below the “then“ are only executed if the condition before is fulfilled. In this case, the heart will not be visible on the LED grid, as the decision variable is not equal to 1. You can find the if…then block in the Logic section.

Step 2

And on we go

After the if…then block the program continues in any case, no matter whether the condition was fulfilled before or not.

Step 3

If – then – else

If you expand the if…then block, the first if condition is checked first, if it is not fulfilled the second if condition is checked. Only those actions are triggered for which the associated condition is fulfilled.

Click on the + on the bottom of the block to unfold the if…then block. The probability to display either a happy or a sad smiley on the LED grid is 50/50.

basic.showLeds(`
    . # . # .
    # # # # #
    # # # # #
    . # # # .
    . . # . .`);