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:programmingblocks [2018/11/29 15:09]
kniwwelino [Deleting blocks]
en:programmingblocks [2018/11/29 15:26] (current)
kniwwelino [Connecting blocks]
Line 1: Line 1:
 +===== Programming with Kniwwelino Blockly=====
  
 +The visual programing tool allows you to create code by assembling blocks like puzzle pieces. 
 +
 +==== Basic Structure ====
 +The basic structure of a program is given by the following two Kniwwelino blocks : 
 +
 +{{:en:firstprogram1.png?400|}}
 +
 +''Kniwwelino on start'' contains the blocks which are only executed once, at the start of Kniwwelino (for instance the variables initialisation).
 +
 +''Kniwwelino repeat forever'' contains the blocks which are executed repeatedly, while Kniwwelino is powered.
 +
 +==== The blocks ====
 +All blocks available are organised in categories. In this section you can get information an all available blocks and how they can be used. Click on the image to get more information on the blocks available in that category.
 +^Category   ^ Description     
 +| [[en:programmingblocks:matrix|{{:en:matrix_cat.jpg|}}]] | Blocks you need to program the 5x5 red lights in the middle of your Kniwwelino. For instance, you can show an icon or a text. [[en:programmingblocks:matrix|...more]]|
 +| [[en:programmingblocks:buttons|{{:en:button_cat.jpg|}}]] | Blocks you need to program buttons A and B on the Kniwwelino. In addition, there are blocks to program external buttons that can be attached on the Kniwwelino pins. [[en:programmingblocks:buttons|...more]] |
 +| [[en:programmingblocks:led|{{:en:led_cat.jpg|}}]] | Blocks you need to program the RGB light above the matrix. You can select the color, brightness and effect. In addition, there are blocks to program external LEDs that can be attached on the Kniwwelino pins. [[en:programmingblocks:led|...more]]|
 +| [[en:programmingblocks:messages|{{:en:messages_cat.jpg|}}]] | Blocks you need to send and receive messages via Wifi. You can, for instance, send an icon or text to another Kniwwelino.[[en:programmingblocks:messages|...more]] |
 +| [[en:programmingblocks:logic|{{:en:logic_cat.jpg|}}]] | Blocks related to logic, such as if-then conditions, or the comparison of two numbers. [[en:programmingblocks:logic|...more]] |
 +| [[en:programmingblocks:variables|{{:en:variables_cat.jpg|}}]] | Blocks you need to create variables, i.e. placeholders to hold a value or a text and reuse it later in your program. [[en:programmingblocks:variables|...more]] |
 +| [[en:programmingblocks:loops|{{:en:loops_cat.jpg|}}]] | Blocks you need if you want to repeat a same piece of code multiple times. [[en:programmingblocks:loops|...more]]|
 +| [[en:programmingblocks:math|{{:en:math_cat.jpg|}}]] | Blocks related to numbers and mathematical operations on numbers, such as addition, substraction, but also rounding or generating random numbers. [[en:programmingblocks:math|...more]] | 
 +| [[en:programmingblocks:text|{{:en:text_cat.jpg|}}]] | Blocks you need to create text or do operations on text, such as concatenating text [[en:programmingblocks:text|...more]] |
 +| [[en:programmingblocks:time|{{:en:time_cat.jpg|}}]] | Blocks you need to control time in your program, for instance to let Kniwwelino wait before the next block, or to get the current date or time. [[en:programmingblocks:time|...more]] |
 +
 +
 +==== Connecting blocks ====
 +To compose your program, you need to connect one block after the other. Drag and drop the blocks to connect them. As soon as you see a yellow mark, you can connect them. 
 +
 +{{:en:firstprogram3.jpg?direct&500}}
 +
 +==== Deleting blocks ====
 +To delete a single block, you can either:
 +  * Drag and drop it to the bin
 +{{:en:blockly_delete.jpg?direct&200|}}
 +
 +  * Right-Click on it and select 'delete block'
 +{{:en:blockly_delete_2.jpg?direct&400|}}
 +
 +  * Or select it and press 'delete' on your keyboard
 +
 +If you want to delete all blocks, click on the bin on the top right of the window.
 +
 +{{:en:blockly_delete_all.jpg?direct&100|}}
 +==== Duplicating blocks ====
 +You can duplicate blocks by either
 +  * Right-clicking on the block and selecting 'duplicate'
 +
 +{{:en:blockly_duplicate.jpg?direct&400|}}
 +
 +  * Or selecting a block and using the shortcuts 'ctrl+c' and 'ctrl+v'
 +
 +==== Transfering the code ====
 +To transfer your code to the Kniwwelino, press the orange play button.
 +
 +{{:en:firstprogram5.jpg|}}
 +
 +Beware: before using this button, be sure to have made all the required [[en:preparation|]].
 +
 +==== Save and load programs ====
 +To save your program on your hard disk, open the menu accessible from the top left. With the  ''save'' button you can save the code as an xml file on your hard disk and open it later with the ''open'' button.
 +
 +{{:en:menu1.png?400|}} {{:en:menu2.png?400|}} \\
 +
 +==== Change the language ====
 +You can change the language also from the menu (see previous point).
 +
 +==== Getting help ====
 +If you need more information on how to use a specific block, you can right-click on the block and select 'help'. It will open the related page from this documentation website.
 +
 +{{:en:blockly_help.jpg?direct&400|}}