Line 21: |
Line 21: |
| end | | end |
| end | | end |
| + | |
| + | Can also be programmed with events. The previous program is equivalent to the following: |
| + | |
| + | local function adelante() |
| + | Motores.setvel2mtr( 1, 500, 1, 500 ) |
| + | end |
| + | local function esperar() |
| + | Motores.setvel2mtr( 1, 0, 1, 0 ) |
| + | wait( 1 ) |
| + | end |
| + | |
| + | events.add( Dist.getDistancia, '<', 700, esperar ) |
| + | events.add( Dist.getDistancia, '>', 700, adelante ) |
| + | events.go() |