Reference.DigitalWrite History

Hide minor edits - Show changes to output

February 03, 2014, at 03:35 PM by Scott Fitzgerald -
Changed lines 8-9 from:
If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the [[Tutorial/DigitalPins | 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. ''NB: It is recommended to set the [[pinMode]]() to [[Constants|INPUT_PULLUP]] to enable the internal pull-up resistor. See the [[Tutorial/DigitalPins | digital pins tutorial]] for more information. ''
to:
If the pin is configured as an INPUT, digitalWrite() will enable (HIGH) or disable (LOW) the internal pullup on the input pin. It is recommended to set the [[pinMode]]() to [[Constants|INPUT_PULLUP]] to enable the internal pull-up resistor. See the [[Tutorial/DigitalPins | digital pins tutorial]] for more information.

NOTE: If you do not set the pinMode() to OUTPUT, and connect an LED to a pin, when calling digitalWrite(HIGH), the LED may appear dim. Without explicitly setting pinMode(), digitalWrite() will have enabled the internal pull-up resistor, which acts like a large current-limiting resistor.
February 03, 2014, at 03:28 PM by Scott Fitzgerald -
Changed lines 8-9 from:
If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the [[Tutorial/DigitalPins | 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. ''NB: It is recommended to set the [[pinMode]]() to INPUT_PULLUP to enable the internal pull-up resistor. See the [[Tutorial/DigitalPins | digital pins tutorial]] for more information. ''
to:
If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the [[Tutorial/DigitalPins | 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. ''NB: It is recommended to set the [[pinMode]]() to [[Constants|INPUT_PULLUP]] to enable the internal pull-up resistor. See the [[Tutorial/DigitalPins | digital pins tutorial]] for more information. ''
Changed line 48 from:
* [[Tutorial/DigitalPins | Tutorial: Digital Pins]]
to:
* [[Tutorial/DigitalPins | Tutorial: Digital Pins]]
February 03, 2014, at 03:27 PM by Scott Fitzgerald -
Changed lines 8-11 from:
If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the [[Tutorial/DigitalPins | 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.

'''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.
to:
If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the [[Tutorial/DigitalPins | 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. ''NB: It is recommended to set the [[pinMode]]() to INPUT_PULLUP to enable the internal pull-up resistor. See the [[Tutorial/DigitalPins | digital pins tutorial]] for more information. ''
Deleted line 48:
September 17, 2010, at 05:07 PM by David A. Mellis -
Changed lines 45-46 from:
The analog input pins can also be used as digital pins, referred to as numbers 14 (analog input 0) to 19 (analog input 5).
to:
The analog input pins can be used as digital pins, referred to as A0, A1, etc.
March 09, 2010, at 04:36 AM by Tom Igoe -
Added lines 10-11:
'''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.
January 17, 2010, at 06:30 PM by Paul Badger -
Changed lines 8-9 from:
If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the [[Tutorial/DigitalPins | 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.
to:
If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the [[Tutorial/DigitalPins | 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.
January 17, 2010, at 06:29 PM by Paul Badger -
Changed lines 8-9 from:
If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the [[Tutorial/DigitalPins | 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.
to:
If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 20K pullup resistor (see the [[Tutorial/DigitalPins | 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.
December 24, 2009, at 04:03 AM by David A. Mellis -
Changed lines 4-9 from:
Write a [[Constants|HIGH]] or a [[Constants|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/DigitalPins | 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.
to:
Write a [[Constants|HIGH]] or a [[Constants|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/DigitalPins | 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.
November 20, 2009, at 08:07 AM by Paul Badger -
Changed lines 6-7 from:
If the pin is configured as an INPUT, writing a HIGH value will enable an internal 20K pullup resistor (see the [[Tutorial/DigitalPins | tutorial on digital pins]]). Writing LOW will disable the pullup.
to:
If the pin is configured as an INPUT, writing a HIGH value with ''digitalWrite'' will enable an internal 20K pullup resistor (see the [[Tutorial/DigitalPins | tutorial on digital pins]]). Writing LOW will disable the pullup.
November 20, 2009, at 02:34 AM by Paul Badger -
Changed lines 8-9 from:
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.
to:
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.
November 20, 2009, at 02:33 AM by Paul Badger -
Changed lines 6-7 from:
If the pin is configured as an INPUT, writing a HIGH value will enable an internal 20K pullup resistor (see the [[Tutorial/DigitalPins | tutorial on digital pins]]). Writing LOW will disable the pullup.
to:
If the pin is configured as an INPUT, writing a HIGH value will enable an internal 20K pullup resistor (see the [[Tutorial/DigitalPins | 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.
February 21, 2009, at 10:23 PM by David A. Mellis -
Changed lines 6-7 from:
If the pin is configured as an INPUT, writing a HIGH value will enable an internal 20K [[Tutorial/DigitalPins | pullup resistor]]. Writing LOW will disable the pullup.
to:
If the pin is configured as an INPUT, writing a HIGH value will enable an internal 20K pullup resistor (see the [[Tutorial/DigitalPins | tutorial on digital pins]]). Writing LOW will disable the pullup.
February 21, 2009, at 10:22 PM by David A. Mellis -
Changed lines 46-47 from:
* Tutorial: [[Tutorial/DigitalPins | Description of the pins on an Arduino board]]
to:
* [[Tutorial/DigitalPins | Tutorial: Digital Pins]]
February 21, 2009, at 10:13 PM by David A. Mellis -
Changed lines 1-3 from:
!!digitalWrite(pin, value)

to:
!!digitalWrite()
Added lines 8-10:
!!!!Syntax
digitalWrite(pin, value)
Changed lines 12-13 from:
pin: the pin number (''int'')\\
to:
pin: the pin number
Changed lines 44-48 from:
* [[Tutorial/DigitalPins | Description of the pins on an Arduino board]]
* [[pinMode]]
* [[digitalRead]]

to:
* [[pinMode]]()
* [[digitalRead]]()
* Tutorial: [[Tutorial/DigitalPins | Description of the pins on an Arduino board]]
December 29, 2008, at 12:58 AM by Paul Badger -
Changed lines 5-8 from:
Write a [[Constants|HIGH]] or a [[Constants|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 [[Tutorial/DigitalPins | pullup resistor]]. Writing LOW will disable the pullup.
to:
Write a [[Constants|HIGH]] or a [[Constants|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 [[Tutorial/DigitalPins | pullup resistor]]. Writing LOW will disable the pullup.
October 04, 2008, at 01:46 PM by David A. Mellis -
Changed lines 5-8 from:
Sets a pin configured as OUTPUT to either a [[Constants|HIGH]] or a [[Constants|LOW]] state at the specified pin.

The digitalWrite() function is also used to set [[Tutorial/DigitalPins | pullup resistors]] when a pin is configured as an [[Constants|INPUT]].
to:
Write a [[Constants|HIGH]] or a [[Constants|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 [[Tutorial/DigitalPins | pullup resistor]]. Writing LOW will disable the pullup.
Changed lines 10-11 from:
pin: the pin number\\
to:
pin: the pin number (''int'')\\
March 31, 2008, at 01:15 PM by Paul Badger -
Changed lines 5-6 from:
Ouputs either [[Constants|HIGH]] or [[Constants|LOW]] at a specified pin.
to:
Sets a pin configured as OUTPUT to either a [[Constants|HIGH]] or a [[Constants|LOW]] state at the specified pin.

The digitalWrite() function is also used to set [[Tutorial/DigitalPins | pullup resistors]] when a pin is configured as an [[Constants|INPUT]].
February 14, 2008, at 04:29 AM by David A. Mellis -
Changed line 40 from:
* [[http://www.arduino.cc/playground/Learning/Pins | Description of the pins on an Arduino board]]
to:
* [[Tutorial/DigitalPins | Description of the pins on an Arduino board]]
February 02, 2008, at 04:05 PM by Paul Badger -
Changed lines 37-38 from:
The analog input pins can be used as digital pins, referred to as numbers 14 (analog input 0) to 19 (analog input 5).
to:
The analog input pins can also be used as digital pins, referred to as numbers 14 (analog input 0) to 19 (analog input 5).
January 19, 2008, at 04:40 PM by David A. Mellis - i'm not sure digitalWrite() needs to link to an explanation of ADCs, etc.
Deleted line 40:
* [[AnalogPins | analog pins]]
January 18, 2008, at 07:30 PM by Paul Badger -
January 18, 2008, at 05:53 PM by Paul Badger -
Changed lines 37-38 from:
The analog input pins can be used as digital pins w/ numbers 14 (analog input 0) to 19 (analog input 5).
to:
The analog input pins can be used as digital pins, referred to as numbers 14 (analog input 0) to 19 (analog input 5).
January 18, 2008, at 04:14 PM by David A. Mellis -
Deleted lines 9-11:

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.
Changed lines 35-38 from:
to:
!!!!Note

The analog input pins can be used as digital pins w/ numbers 14 (analog input 0) to 19 (analog input 5).
January 18, 2008, at 06:17 AM by Paul Badger -
Changed lines 11-12 from:
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.
to:
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.
January 18, 2008, at 06:16 AM by Paul Badger -
Added line 10:
January 18, 2008, at 06:16 AM by Paul Badger -
Added line 9:
January 18, 2008, at 06:15 AM by Paul Badger -
Changed lines 9-10 from:
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.
to:
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.
January 18, 2008, at 06:14 AM by Paul Badger -
Changed lines 8-9 from:
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.
to:
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.
Added line 39:
* [[AnalogPins | analog pins]]
January 18, 2008, at 06:11 AM by Paul Badger -
Changed lines 8-9 from:
pin: the pin number
to:
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.
Deleted line 41:
[[HomePage | Reference Home]]
January 11, 2008, at 06:40 PM by David A. Mellis -
Changed line 37 from:
* [[delay]]
to:
* [[http://www.arduino.cc/playground/Learning/Pins | Description of the pins on an Arduino board]]
January 13, 2006, at 12:37 AM by 82.186.237.10 -
Added lines 40-42:


[[HomePage | Reference Home]]
December 28, 2005, at 10:46 PM by 82.186.237.10 -
Changed lines 1-4 from:
!!DigitalWrite


!!!!What it does
to:
!!digitalWrite(pin, value)


!!!!Description
Changed lines 7-13 from:

!!!!What parametres does it take
You need to specify the number of the pin you want to set followed by the word HIGH or LOW.

!!!!This function returns
nothing
to:
!!!!Parameters
pin: the pin number

value: [[Constants|HIGH]] or [[Constants|LOW]]

!!!!Returns
none
December 03, 2005, at 07:47 PM by 213.140.6.103 -
Changed lines 5-7 from:
Outputs a series of digital pulses that act like an analogue voltage.

to:
Ouputs either [[Constants|HIGH]] or [[Constants|LOW]] at a specified pin.

Changed lines 9-11 from:
you need to specify the number of the pin y
ou want to configure followed by the word INPUT or OUTPUT.
to:
You need to specify the number of the pin you want to set followed by the word HIGH or LOW.
Changed lines 32-34 from:
configures pin number 13 to work as an output pin.

to:
Sets pin 13 to HIGH, makes a one-second-long delay, and sets the pin back to LOW.

Changed lines 36-37 from:
* [[digitalWrite]]
to:
* [[delay]]
* [[pinMode]]
December 03, 2005, at 07:42 PM by 213.140.6.103 -
Changed lines 16-17 from:
[@
to:
[@
Deleted line 18:
Deleted line 19:
Deleted line 20:
Deleted line 21:
Deleted line 24:
Deleted line 25:
Deleted line 26:
Deleted line 27:
Deleted line 28:
Deleted line 29:
December 03, 2005, at 07:40 PM by 213.140.6.103 -
Added line 20:
Added line 22:
Added line 24:
Added line 26:
Added line 30:
Added line 32:
Added line 34:
Added line 36:
Added line 38:
Added line 40:
December 03, 2005, at 07:39 PM by 213.140.6.103 -
Changed lines 16-17 from:
[=
to:
[@
Changed lines 32-33 from:
=]
to:
@]
December 03, 2005, at 07:39 PM by 213.140.6.103 -
Changed lines 16-17 from:
[@
to:
[=
Changed lines 32-33 from:
@]
to:
=]
November 27, 2005, at 05:20 PM by 81.154.199.248 -
Added lines 1-39:
!!DigitalWrite


!!!!What it does
Outputs a series of digital pulses that act like an analogue voltage.


!!!!What parametres does it take
you need to specify the number of the pin y
ou want to configure followed by the word INPUT or OUTPUT.

!!!!This function returns
nothing

!!!!Example
[@

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.


!!!!See also
* [[digitalWrite]]
* [[digitalRead]]

Share