Differences

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

Link to this comparison view

Both sides previous revision Previous revision
en:programmingblocks:buttons [2018/02/20 16:24]
kniwwelino
en:programmingblocks:buttons [2018/05/24 13:59] (current)
kniwwelino [Blocks]
Line 1: Line 1:
 +===== Buttons =====
  
 +==== Blocks ====
 +
 +=== If button was clicked ===
 +{{:en:programmingblocks:button_1.png|}}
 +
 +This block detects if the specified button has been clicked and executes the blocks added next to ''then''. Each time the button is clicked (pressed and released), the blocks next to ''then'' are only executed once.
 +
 +Options: 
 +  * ''A'': button on the left on the Kniwwelino
 +  * ''B'': button on the right on the Kniwwelino
 +  * ''A and B'': both buttons at the same time
 +  * ''A or B'': either button A or button B
 +
 +\\
 +=== If button was clicked ===
 +{{:en:programmingblocks:button_2.png|}}
 +
 +This block detects if the button A, button B, or button A and B have been clicked and executes in each case the blocks added next to corresponding ''then''. Each time a button is clicked (pressed and released), the blocks next to the corresponding ''then'' are only executed once.
 +
 +Options: 
 +  * ''A'': button on the left on the Kniwwelino
 +  * ''B'': button on the right on the Kniwwelino
 +  * ''A and B'': both buttons at the same time
 +  * ''A or B'': either button A or button B
 +
 +\\
 +=== Button was clicked ===
 +{{:en:programmingblocks:button_3.png|}}
 +
 +This block detects if the specified button has been clicked (pressed and released). 
 +
 +If this is the case, it returns ''true'', otherwise it returns ''false''. It can, for instance, be used as part of a ''if - then'' block or a ''repeat until'' loop.
 +
 +Options: 
 +  * ''A'': button on the left on the Kniwwelino
 +  * ''B'': button on the right on the Kniwwelino
 +  * ''A and B'': both buttons at the same time
 +  * ''A or B'': either button A or button B
 +
 +\\
 +=== Button is pressed ===
 +{{:en:programmingblocks:button_4.png|}}
 +
 +This block detects if the specified button is currently pressed. If this is the case, it returns ''true'', otherwise it returns ''false''. It can, for instance, be used as part of a ''if - then'' block or a ''repeat until'' loop.
 +
 +Options: 
 +  * ''A'': button on the left on the Kniwwelino
 +  * ''B'': button on the right on the Kniwwelino
 +  * ''A and B'': both buttons at the same time
 +  * ''A or B'': either button A or button B
 +
 +\\
 +=== External button was clicked ===
 +{{:en:programmingblocks:button_5.png|}}
 +
 +This block detects if an external button on the specified pin was clicked (pressed and released). It can be used in the same way as the internal buttons.
 +
 +Please refer to [[en:extensions:extbuttons|]] for getting more information on how to attach and program external buttons.
 +
 +\\
 +=== External button is pressed ===
 +{{:en:programmingblocks:button_6.png|}}
 +
 +This block detects if an external button on the specified pin is currently pressed. It can be used in the same way as the internal buttons.
 +
 +Please refer to [[en:extensions:extbuttons|]] for getting more information on how to attach and program external buttons.
 +
 +\\
 +==== Example ====
 +
 +The following example shows you how to use both of the buttons in your program. When clicking button A, a smiling face is shown. When clicking on button B, a sad face is shown.
 +
 +{{:en:programmingblocks:button_example1.png|}}
  • en/programmingblocks/buttons.txt
  • Last modified: 2018/05/24 13:59
  • by kniwwelino