-
Notifications
You must be signed in to change notification settings - Fork 2
Event program 2.0
This type of program have different blocks, these blocks are when blocks, these work like a event, when a condition is true this is execute.
Below is shown how you can create this type of programs.
In folder learnbot_dsl/learnbotCode/examples/ there are some examples. We can open the example follow_red_line_with_events.blockProject with the Learnblock program .
In order to execute this example you should check the checkbox Used Events.
This example have 5 when blocks.
This block is executed when the robot doesn't see the red line.
This block is executed when the robot sees the red line on its right.
This block is executed when the robot sees the red line on its left.
This block is executed when the robot sees the red line on its center.
This block is executed when the robot sees the red line cross with black line.
In Learnblock, with the checkbox Used Events checked, you can push button Add When in control panel.
Then you should choose the type and the name of the block.
There are two type of blocks:
This type need a condition and when condition is true the block is activated.
This type have two functions Activate nameWhen and Deactivate nameWhen for active and deactivate the block.
Both have a variable with its own the time of execution. It is restartes when the block is deactivated and its value is 0.