Light blinking2.nxc

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

/*

	This program demonstrates using 
	generator of random numbers

	light bulb is connected to the port A
*/
int delay;
int i;


task main()
{
 while(1)
 {
  Off(OUT_ABC);
  i=random(12);
  
  if (i%2==0)
     OnFwd(OUT_A,50);
  if(i%3)
     OnFwd(OUT_B,50);
  if(i%4)
     OnFwd(OUT_C,50);

  delay=random(250)+50;
      Wait(delay);

 }
}