Skip to main content
2 of 2
deleted 4 characters in body
Majenko
  • 105.9k
  • 5
  • 82
  • 139

You need to put the correct number into the pinMode() function.

You could put the number into a variable like:

int ledPin = 13;
pinMode(ledPin, OUTPUT);

or you can put a number straight into pinMode() like this:

pinMode(13, OUTPUT);

Whatever number you put in will be the pin that you start using.

Here's an example to blink the onboard LED:

int ledPin = 13;                 // LED connected to digital pin 13

void setup()
{
  pinMode(ledPin, OUTPUT);      // Whatever number is in ledPin is made an output.
}

void loop()
{
  digitalWrite(ledPin, HIGH);   // sets the LED on
  delay(1000);                  // waits for a second
  digitalWrite(ledPin, LOW);    // sets the LED off
  delay(1000);                  // waits for a second
}
James
  • 343
  • 3
  • 9