1
Configure the pin
pinMode(ledPin, OUTPUT) sets digital pin 13 as an output.
Change the parameters, run the simulation and watch how an Arduino controls an LED. Switch between a virtual breadboard and a simplified circuit diagram.
// Experiment 01: Blink an LED const int ledPin = 13; const int onTime = 500; const int offTime = 500; void setup() { pinMode(ledPin, OUTPUT); } void loop() { // Turn LED on digitalWrite(ledPin, HIGH); delay(onTime); // Turn LED off digitalWrite(ledPin, LOW); delay(offTime); }
The Arduino repeats a simple ON → wait → OFF → wait sequence. Adjust the timings above and observe how the blink frequency changes.
pinMode(ledPin, OUTPUT) sets digital pin 13 as an output.
digitalWrite(HIGH) drives the pin high. The LED stays on for 500 ms.
digitalWrite(LOW) drives the pin low. The LED stays off for 500 ms.
The loop() function repeats. One cycle takes 1.0 s, giving 1.00 Hz.