Skip to main content
deleted 4 characters in body
Source Link
Majenko
  • 105.5k
  • 5
  • 80
  • 138

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(ledPin13, 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
}

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(ledPin, 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
}

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
}
Source Link
James
  • 345
  • 3
  • 9

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(ledPin, 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
}