Activities/Butialo: Difference between revisions

Tonyforster (talk | contribs)
Tonyforster (talk | contribs)
Line 44: Line 44:
   
   
  while true do
  while true do
print ("Presione el botón para comenzar")
    print ("Presione el botón para comenzar")
repeat until Boton.getBoton()==1
    repeat until Boton.getBoton()==1
 
eq = Dist.getDistancia()  
    eq = Dist.getDistancia()  
 
print("Arrancando", eq)
    print("Arrancando", eq)
util.wait(1)
    util.wait(1)
 
repeat
    repeat
d = Dist.getDistancia()
        d = Dist.getDistancia()
v = 100+5*math.abs(d-eq)
        v = 100+5*math.abs(d-eq)
if v > 1024 then v = 1024 end
        if v > 1024 then v = 1024 end
if d < eq then
        if d < eq then
Motores.setvel2mtr(1, v, 1, v)
            Motores.setvel2mtr(1, v, 1, v)
else
        else
Motores.setvel2mtr(0, v, 0, v)
            Motores.setvel2mtr(0, v, 0, v)
end
        end
until Boton.getBoton()==1
    until Boton.getBoton()==1
 
print("Fin")
    print("Fin")
Motores.setvel2mtr(1, 0, 1, 0)
    Motores.setvel2mtr(1, 0, 1, 0)
util.wait(1)
    util.wait(1)
  end
  end


==Continue reading in Spanish==
==Continue reading in Spanish==
[http://www.fing.edu.uy/inco/proyectos/butia/mediawiki/index.php/Butialo]
[http://www.fing.edu.uy/inco/proyectos/butia/mediawiki/index.php/Butialo]