Blink and pulse digital pins for LEDs, relays, indicators, and simple actuators.
Open in compiler →Source code and build tools are available in the protected platform workspace.
How it works
Turn a digital output on and off for an LED, relay module, or simple indicator.
- Connect the LED/resistor or module input to ledPin.
- Set ledPin as OUTPUT in setup().
- Use digitalWrite(HIGH) and digitalWrite(LOW) in loop().
- Change the two delay() values to control blink speed.
Connections
| Pin | Connect to | Note |
|---|---|---|
| D2 | LED through 220-330 ohm resistor, relay module input, or indicator | Do not connect a bare load directly to an Arduino pin. |