Zvukovy senzor.nxc

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

Krúžok Robotiky

/* zvukovy senzor.nxc

Robot ma dva motory v portoch A a C ide dopredu ale
ked zvukovy senzor v porte 4 zachyti hluk vacsi ako 40 decibelov tak sa zacne tocit na mieste 

Autor: Matej Kurilla

*/

 #include"NXCdefs.h"
 #define hluk 40
task senzorzvukovy()


    {
    int zvuky;
     SetSensorSound(IN_4);     //zvukovy senzor v 4 porte

     while(true)
       {
       zvuky=SENSOR_4;
       /*program robí to, že keď je veľký hluk, tak sa začne točiť  */
        while (zvuky>=hluk)
          {
            OnRev(OUT_C,50);
            OnFwd(OUT_A,50);
             zvuky=SENSOR_4;
          }
      OnFwd(OUT_AC,50);


        }
    }
    
/*


*/
    
    
task main()
{
OnFwd(OUT_AC,50);
start senzorzvukovy;

}