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.

Needed materials

  • 1 Kniwwelino
  • 1 USB cable
  • 1 power source (powerbank or USB charger)
  • 1 A4 sheet of white paper
  • scissors and glue
  • 1 rubber band
  • 1 ice cream stick
  • double-sided tape
  • cardboard

Programming

Step 1: set the color of the LED

To set the color of the LED, use the following block and put it into Kniwwelino repeat forever.

To make the LED blink, change set the block option to blink.

Step 3: change the colour of the LED when you click on button A

  • To be able to change the colour when you click on button A, you need to use a variable which keeps track on how often you clicked on button A. First, initialise your variable in Kniwwelino on start:

  • Now you want this variable to be increased each time you click button A. However, it should only count to 5, after that it should restart at 0:

  • For each of the values of 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

  • Now call the function set color and effect as part of the blocks executed when button A is clicked.

Step 4: change the blinking effect when you click on button B

  • Use a second variable 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.

  • Inside the function 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.

Solution

Open Project in KniwwelinoBlockly

Crafting

Model

The model for the multicolor lamp is available here: model_lamp.pdf

Instructions

  • Use the rubber band to fix the ice cream stick onto the Kniwwelino



  • Use a piece of double-sided tape, to fix the Kniwwelino onto the piece of cardboard



  • Print and cut the model.



  • First fold the paper on the two small horizontal lines (while opening the second fold again). Then fold it at the smaller vertical line. Then fold all the remaining verical, horizontal and diagonal lines and cut the vertical lines for the cover.



  • Join both vertical ends with some glue.



  • Close the cover by fixing the different parts with glue.



  • Cut three holes at the border for the ice cream stick and the USB cable. Add the labels for the ice cream stick.