Go Down

Topic: random led blink code check (Read 14437 times) previous topic - next topic


so how do i make them fade between each phase ?

Look at the Fade example for the code to use in place of just turning the LED off.


Hai ,

Fantastic project, this is what I was looking for to make my drawbot work autonomously

I still have a question, is it possible to burn the 2 LEDs that I use simultaneously as random

So you could choose between 1led on, or 2nd led on or both on in random

Can you help me please

Code: [Select]

int ranNum;
int ranDel;

void setup() {
  Serial.println("Starting new Random Number Sequence");
    randomSeed(analogRead(0));          // Seed RNG from analog port.

 pinMode(2, OUTPUT);                    // Setup 2 output ports for LED's
 pinMode(3, OUTPUT);
void loop() {
    ranNum=random(2,4);                 // Generate random number between 2 and 3
    ranDel=random(25,300);              // Generate random delay time 25,300
    digitalWrite(ranNum, HIGH);         // Turn on the LED
    digitalWrite(ranNum, LOW);          // Turn off the LED 

  Serial.print("The Random Number is = ");
  Serial.println(ranNum : ranDel) ;
  //Serial.print("The Random Delay is  = ");

Go Up