A small lamp, made from a sheet of paper which is folded using a simple Origami technique, and illuminated through the RGB LED. With the two buttons of the Kniwwelino, you can change the color of the lamp and its blinking effect.
To program the lamp, you will need to use blocks from the buttons, the LEDs, the variables, logics, and functions.
Kniwwelino on start
:valueA
, you now want to define a different colour, and, afterwards, set this colour to the RGB LED. As we will reuse this code later for the effect, we will define it as a new function set color and effect
set color and effect
as part of the blocks executed when button A is clicked.valueB
to count how often button B has been clicked. Initialise it in the same way as valueA
:valueB
is increased each time button B is clicked (in the same approach as for valueA
). We are planning to have 4 different effects, so we set valueB
to 0 as soon as it reaches 4. We then call again the function set color and effect
.set color and effect
we now need to check the value of valueB
and switch on the RGB LED with another effect. This code replaces the individual block Set RGB LED to color … on
.Open Project in KniwwelinoBlockly
The model for the multicolor lamp is available here: model_lamp.pdf