Show minor edits - Show changes to markup
The analog input pins can also be used as digital pins, referred to as numbers 14 (analog input 0) to 19 (analog input 5).
The analog input pins can be used as digital pins, referred to as A0, A1, etc.
NOTE: Digital pin 13 is harder to use as a digital input than the other digital pins because it has an LED and resistor attached to it that's soldered to the board on most boards. If you enable its internal 20k pull-up resistor, it will hang at around 1.7 V instead of the expected 5V because the onboard LED and series resistor pull the voltage level down, meaning it always returns LOW. If you must use pin 13 as a digital input, use an external pull down resistor.
If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the reference page on digital pins). Writing LOW will disable the pullup. The pullup resistor is enough to light an LED dimly, so if LEDs appear to work, but very dimly, this is a likely cause. The remedy is to set the pin to an output with the pinMode() function.
If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the tutorial on digital pins). Writing LOW will disable the pullup. The pullup resistor is enough to light an LED dimly, so if LEDs appear to work, but very dimly, this is a likely cause. The remedy is to set the pin to an output with the pinMode() function.
If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the tutorial on digital pins). Writing LOW will disable the pullup. The pullup resistor is enough to light an LED dimly, so if LEDs appear to work, but very dimly, this is a likely cause. The remedy is to set the pin to an output with the pinMode() function.
If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the reference page on digital pins). Writing LOW will disable the pullup. The pullup resistor is enough to light an LED dimly, so if LEDs appear to work, but very dimly, this is a likely cause. The remedy is to set the pin to an output with the pinMode() function.
Write a HIGH or a LOW value to a digital pin. If the pin has been configured as an OUPUT with pinMode(), its voltage will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW.
If the pin is configured as an INPUT, writing a HIGH value with digitalWrite will enable an internal 20K pullup resistor (see the tutorial on digital pins). Writing LOW will disable the pullup.
The 20K pullup resistor is enough to light an LED dimly, so if LEDs appear to work, but very dimly, this is a likely cause. The remedy is to set the pin to an output with the pinmode function.
Write a HIGH or a LOW value to a digital pin.
If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW.
If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the tutorial on digital pins). Writing LOW will disable the pullup. The pullup resistor is enough to light an LED dimly, so if LEDs appear to work, but very dimly, this is a likely cause. The remedy is to set the pin to an output with the pinMode() function.
If the pin is configured as an INPUT, writing a HIGH value will enable an internal 20K pullup resistor (see the tutorial on digital pins). Writing LOW will disable the pullup.
If the pin is configured as an INPUT, writing a HIGH value with digitalWrite will enable an internal 20K pullup resistor (see the tutorial on digital pins). Writing LOW will disable the pullup.
The 20K pullup resistor is enough to light an LED dimly, so if LED's appear to work, but very dimly, this is a likely cause. The remedy is to set the pin to an output with the pinmode function.
The 20K pullup resistor is enough to light an LED dimly, so if LEDs appear to work, but very dimly, this is a likely cause. The remedy is to set the pin to an output with the pinmode function.
If the pin is configured as an INPUT, writing a HIGH value will enable an internal 20K pullup resistor (see the tutorial on digital pins). Writing LOW will disable the pullup.
If the pin is configured as an INPUT, writing a HIGH value will enable an internal 20K pullup resistor (see the tutorial on digital pins). Writing LOW will disable the pullup.
The 20K pullup resistor is enough to light an LED dimly, so if LED's appear to work, but very dimly, this is a likely cause. The remedy is to set the pin to an output with the pinmode function.
If the pin is configured as an INPUT, writing a HIGH value will enable an internal 20K pullup resistor. Writing LOW will disable the pullup.
If the pin is configured as an INPUT, writing a HIGH value will enable an internal 20K pullup resistor (see the tutorial on digital pins). Writing LOW will disable the pullup.
digitalWrite(pin, value)
pin: the pin number (int)
pin: the pin number
Write a HIGH or a LOW value to a digital pin. If the pin has been configured as an output with pinMode(), its voltage will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW.
If the pin is configured as an input, writing a HIGH value will enable an internal 20K pullup resistor. Writing LOW will disable the pullup.
Write a HIGH or a LOW value to a digital pin. If the pin has been configured as an OUPUT with pinMode(), its voltage will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW.
If the pin is configured as an INPUT, writing a HIGH value will enable an internal 20K pullup resistor. Writing LOW will disable the pullup.
Sets a pin configured as OUTPUT to either a HIGH or a LOW state at the specified pin.
The digitalWrite() function is also used to set pullup resistors when a pin is configured as an INPUT.
Write a HIGH or a LOW value to a digital pin. If the pin has been configured as an output with pinMode(), its voltage will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW.
If the pin is configured as an input, writing a HIGH value will enable an internal 20K pullup resistor. Writing LOW will disable the pullup.
pin: the pin number
pin: the pin number (int)
Sets a pin configured as OUTPUT to either a HIGH or a LOW state at the specified pin.
The digitalWrite() function is also used to set pullup resistors when a pin is configured as an INPUT.
The analog input pins can be used as digital pins w/ numbers 14 (analog input 0) to 19 (analog input 5).
The analog input pins can be used as digital pins, referred to as numbers 14 (analog input 0) to 19 (analog input 5).
valid pin numbers on most boards are 0 to 19, valid pin numbers on the Mini are 0 to 21. Pins 0 to 13 refer to the digital pins and pins 14 to 19 refer to the analog pins, when using the digitalWrite and pinMode commands.
The analog input pins can be used as digital pins w/ numbers 14 (analog input 0) to 19 (analog input 5).
valid pin numbers on most boards are 0 to 19, valid pin numbers on the Mini are 0 to 21. Pins 0 to 13 refer to the digital pins and pins 14 to 19 refer to the analog pins, when using the digitalWrite, and pinMode commands.
valid pin numbers on most boards are 0 to 19, valid pin numbers on the Mini are 0 to 21. Pins 0 to 13 refer to the digital pins and pins 14 to 19 refer to the analog pins, when using the digitalWrite and pinMode commands.
valid pin numbers on most boards are 0 to 19, valid pin number on the Mini are 0 to 21. Pins 0 to 13 refer to the digital pins and pins 14 to 19 refer to the analog pins, when using the digitalWrite, and pinMode commands.
valid pin numbers on most boards are 0 to 19, valid pin numbers on the Mini are 0 to 21. Pins 0 to 13 refer to the digital pins and pins 14 to 19 refer to the analog pins, when using the digitalWrite, and pinMode commands.
pin: the pin number, valid pin numbers on most boards are 0 to 19, valid pin number on the Mini are 0 to 21. Pins 0 to 13 refer to the digital pins and pins 14 to 19 refer to the analog pins, when using the digitalWrite command.
pin: the pin number
valid pin numbers on most boards are 0 to 19, valid pin number on the Mini are 0 to 21. Pins 0 to 13 refer to the digital pins and pins 14 to 19 refer to the analog pins, when using the digitalWrite, and pinMode commands.
pin: the pin number
pin: the pin number, valid pin numbers on most boards are 0 to 19, valid pin number on the Mini are 0 to 21. Pins 0 to 13 refer to the digital pins and pins 14 to 19 refer to the analog pins, when using the digitalWrite command.
You need to specify the number of the pin you want to set followed by the word HIGH or LOW.
nothing
Outputs a series of digital pulses that act like an analogue voltage.
you need to specify the number of the pin y ou want to configure followed by the word INPUT or OUTPUT.
You need to specify the number of the pin you want to set followed by the word HIGH or LOW.
configures pin number 13 to work as an output pin.
Sets pin 13 to HIGH, makes a one-second-long delay, and sets the pin back to LOW.
[@
[@
[=
[@
=]
@]
[@
[=
@]
=]
Outputs a series of digital pulses that act like an analogue voltage.
you need to specify the number of the pin y ou want to configure followed by the word INPUT or OUTPUT.
nothing
int ledPin = 13; // LED connected to digital pin 13
void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin as 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
}
configures pin number 13 to work as an output pin.