Page 50 - Ai Robogenius
P. 50

Input Blocks

                  Input blocks are used to interact with different sensors and buttons. Some of the
                  important input blocks are:

                                        Block                                         Description


                                                                      Do something  when  a specific  button
                                 on  button      A  pressed
                                                                      (A, B or both) is pressed.





                                                                      Do something  when  the gesture  like
                                   on     shake
                                                                      shaking or tilting is detected.





                                                                      Do something when a specific pin (like
                                 on pin       P0  pressed
                                                                      pin 0 or pin 1) is pressed.






                  Logic Blocks

                  Logic blocks let you work with conditions and loops. Some of the important logic

                  blocks are:


                                        Block                                         Description

                                                                      Executes the next block of code if the
                                 if     true     then
                                                                      condition is true.





                                                                      Executes  one block of code  if the
                                 if     true then  then
                                                                      condition  is true  and another  if it  is
                                                                      false.
                                 else







                                                                      Compares if two values are equal, less
                                     0    =     0
                                                                      than or greater than the second value.





                                 AI RoboGenius - IV
                 48
   45   46   47   48   49   50   51   52   53   54   55