Light blinking2.nxc

From RoboWiki
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);

 }
}