Random Led Blinking

HI there,

I got some Leds and want to make blink one random at each loop/every 200ms what fonctions do I use?

There's my actual code :

int pinLed1, pinLed2; void setup() { pinLed1 = 2; pinLed2 = 4;

pinMode(pinLed1, OUTPUT); pinMode(pinLed2, OUTPUT);

digitalWrite(pinLed1, LOW); digitalWrite(pinLed2, LOW); } void loop() { digitalWrite(pinLed1, HIGH); delay(200); digitalWrite(pinLed1, LOW); delay(200); digitalWrite(pinLed2, HIGH); delay(200); digitalWrite(pinLed2, LOW); delay(200); }

Thanks for help (pretty urgent)

As a start look at the random() function and use the value it produces in the delay() function, noting that is not actually the best way to do it.

Try the following

In setup() seed the random number generator with the input from an unconnected analog pin using the randomSeed() function.

In loop() use the random() function to select a number either 0 or 1. Then depending on you random number turn one or the other led on. Wait 100ms turn both leds off. Wait another 100ms and restart the loop.