Untitled

mail@pastecode.io avatar
unknown
plain_text
12 days ago
736 B
9
Indexable
Never
#define redPin 10
#define bluePin 9

void setup() {
  // put setup code here, to run once:
  pinMode(redPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
}


void loop() {
  // put main code here, to run repeatedly:
  blinkLED(redPin, 3, 500); //Turn ON OFF RED LED
  delay(100);
  blinkLED(bluePin, 3, 500); //TURN ON OFF BLUE LED
  delay(100);
}


// LED BLINKING FUNCTION
void blinkLED(int pin, int numOfBlinks, int blinkDelay) {
  for (int i = 0; i < numOfBlinks; i++) {
    digitalWrite(pin, HIGH);   // Turn the Blue LED on
    delay(blinkDelay);         // Wait for the specified delay
    digitalWrite(pin, LOW);    // Turn the Blue LED off
    delay(blinkDelay);         // Wait for the specified delay
  }
}
Leave a Comment