en:instructions:lampmulticolor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:instructions:lampmulticolor [2018/07/13 14:24]
kniwwelino
en:instructions:lampmulticolor [2018/07/13 14:32] (current)
kniwwelino [Needed materials]
Line 1: Line 1:
 +===== Multicolor Lamp =====
 +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. 
  
 +{{:en:multicolorlamp.png?400|}} {{:en:instructions:multicolorlamp2.png?400|}}
 +
 +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''.
 +
 +{{:en:programmingblocks:led_1.png|}}
 +
 +=== Step 2: make the LED blink ===
 +To make the LED blink, change set the block option to ''blink''.
 +
 +{{:en:instructions:led_8.png|}}
 +
 +=== 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'':
 +
 +{{:en:instructions:lamp:lamp_s1.png|}}
 +
 +  * 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:
 +
 +{{:en:instructions:lamp:lamp_s2.png|}}
 +
 +  * 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''
 +
 +{{:en:instructions:lamp:lamp_s3.png|}}
 +
 +  * Now call the function ''set color and effect'' as part of the blocks executed when button A is clicked.
 +
 +{{:en:instructions:lamp:lamp_s4.png|}}
 +
 +=== 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'':
 +
 +{{:en:instructions:lamp:lamp_s5.png|}}
 +
 +  * ''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''.
 +
 +{{:en:instructions:lamp:lamp_s6.png|}}
 +
 +  * 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''.
 +
 +{{:en:instructions:lamp:lamp_s7.png|}}
 +
 +  
 +
 +
 +
 +=== Solution ===
 +Open Project in [[https://code.kniwwelino.lu/?xml=examples/Multicolor_Lamp.xml|KniwwelinoBlockly]]
 +
 +[[https://code.kniwwelino.lu/?xml=examples/Multicolor_Lamp.xml|{{:en:instructions:lamp_solution.png|}}]]
 +==== Crafting ====
 +
 +
 +=== Model ===
 +The model for the multicolor lamp is available here: {{ :en:instructions:lamp:model_lamp.pdf |}}
 +
 +=== Instructions ===
 +  * Use the rubber band to fix the ice cream stick onto the Kniwwelino 
 +{{:en:instructions:lampcraft1.jpg?400|}}\\
 +\\
 +
 +  * Use a piece of double-sided tape, to fix the Kniwwelino onto the piece of cardboard
 +{{:en:instructions:lampcraft2.jpg?400|}} \\
 +\\
 +
 +  * Print and cut the model.
 +{{:en:instructions:lampcraft3.jpg?400|}} \\
 +\\
 +
 +  * 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.
 +{{:en:instructions:lampcraft4.jpg?400|}} \\
 +\\
 +
 +  * Join both vertical ends with some glue.
 +{{:en:instructions:lampcraft5.jpg?400|}} \\
 +\\
 +
 +  * Close the cover by fixing the different parts with glue.
 +{{:en:instructions:lampcraft6.jpg?400|}} \\
 +\\
 +
 +  * Cut three holes at the border for the ice cream stick and the USB cable. Add the labels for the ice cream stick.
 +{{:en:multicolorlamp.png?400|}}