Ultrazvuk.nxc

From RoboWiki
Revision as of 10:21, 26 March 2008 by Palo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Krúžok Robotiky

/* ultrazvuk.nxc

Robot ma  senzor ultrazvukovy ktory ked zachyti prekazku bliysie 
ako 30 cm tak robot cuvne o otoci sa na mieste



Autor: Matej Kurilla

*/

task ultrazvuk()
{

int vzdialenost= 30;  //cm

SetSensorLowspeed(IN_2);
 /* program urobí to, že keď sa priblíži k stene na menej ako 30 cm
 tak cúvne a otočí sa */
while (true)
   {
  if (SensorUS(IN_2)<vzdialenost)
      {
      OnRev(OUT_AC,50);
      Wait(800);
      OnFwd(OUT_C,50);
      Wait(1300);
      }
   }
}

task main()
{

start ultrazvuk;



{

while (true)
   {
   
   OnFwd(OUT_AC,50);
   }
}
}