Difference between revisions of "Light blinking2.nxc"

From RoboWiki
Jump to: navigation, search
 
m
 
Line 1: Line 1:
[[Krúžok Robotiky]]
+
[[Krúžok Robotiky]]
 
   
 
   
 
  /*
 
  /*

Latest revision as of 10:28, 26 March 2008

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

 }
}