The CHK My Block

The CHK My Block is used to make a check to see if the robot is upright or has fallen down. If the pwr variable block has an absolute value that is less than 100, timer 2 is reset. When the timer switch block measures a reading less than 1, then the state of the ok variable block is not touched and the balance loop keeps running. The initial state of the ok variable block was false. If the pwr variable block has an absolute value that is equal to 100 (we know it cannot be greater), timer 2 is not affected (thus having a larger value), and the ok variable writes a true statement, which causes the balance loop to end.

The CHK My Block

Looking in more detail, if the logic switch block receives a true value, then Timer Sensor block 2 is reset. Lastly, you saw a Timer Sensor block 2 during the RST My Block. So timer 2 was reset at the beginning of the main programming loop. The compare switch block will change the logic variable block ok to a true condition if timer 2 is greater than 1. If you remember, the logic variable block ok was set to false during the RST My Block. In the main program, the balance loop will continue to run as long as the ok variable is false. If the ok variable is true, then this indicates that the robot has fallen and the balance loop will break.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.8.82