Connect the anode (long leg) of the LED to pin 4 through a current-limiting resistor (e.g., 220Ω).
Connect the cathode (short leg) to GND on the Arduino.
Code
/*Paste your code here*/
int LED = 4;
void setup() {
pinMode(LED, OUTPUT); // Set pin 4 as an output
}
void loop() {
digitalWrite(LED, HIGH); // Turn the LED on
delay(500); // Wait for 500 milliseconds
digitalWrite(LED, LOW); // Turn the LED off
delay(500); // Wait for 500 milliseconds
}