Untitled
unknown
plain_text
a month ago
940 B
20
Indexable
Never
// ************************************************************************ // Created by SWAN LAB, IIT KGP, 01/09/2024 // ************************************************************************ #define redPin 2 #define bluePin 4 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, 50); //Turn ON OFF RED LED delay(100); blinkLED(bluePin, 5, 50); //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