Let’s connect hardware first,
Note: If the maximum current limit is 25 mA, ensure the current stays below this value. However, due to temperature variations, the absolute maximum current may drop to 20mA or lower. It's important to account for temperature effects and aim to limit the current to around 10-15mA for safety.
We will turn ON the LED by making digital pin 4 HIGH for 400 msec and OFF by making digital pin 4 LOW for 800 msec continuously.
const int led = 4; // LED is connected to the pin 4
void setup() {
pinMode(led, OUTPUT); // Set the LED pin as an output
}
void loop() {
digitalWrite(led, HIGH); // LED is turn ON
delay(400); // waits for a 400 millisecond
digitalWrite(led, LOW); // LED is turn OFF
delay(800); // waits for a 800 millisecond
}
We will turn ON the LED by making digital pin 4 LOW for 400 msec and OFF by making digital pin 4 HIGH for 800 msec continuously.
const int led= 4; // LED connected to pin 4
void setup() {
pinMode(led, OUTPUT); // Set the LED pin as an output
}
void loop() {
digitalWrite(led, LOW); // LED is turn ON
delay(400); // waits for a 400 millisecond
digitalWrite(led, HIGH); // LED is turn OFF
delay(800); // waits for a 800 millisecond
}
This shows that GPIO has an internal resistance of 25 ohms.