Reference.DigitalRead History

Hide minor edits - Show changes to markup

April 14, 2013, at 09:47 AM by Scott Fitzgerald -
Changed lines 17-18 from:
to:
April 14, 2013, at 09:47 AM by Scott Fitzgerald -
Changed lines 16-18 from:
 [@
to:
Changed lines 34-37 from:

@]

Sets pin 13 to the same value as the pin 7, which is an input.

to:
September 17, 2010, at 05:07 PM by David A. Mellis -
Changed lines 39-40 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 A0, A1, etc.

January 17, 2010, at 06:39 PM by Paul Badger -
February 21, 2009, at 10:21 PM by David A. Mellis -
Changed lines 44-45 from:
to:
February 21, 2009, at 10:19 PM by David A. Mellis -
Changed lines 44-45 from:
to:
February 21, 2009, at 10:19 PM by David A. Mellis -
Changed lines 42-44 from:
to:
October 04, 2008, at 01:48 PM by David A. Mellis -
Changed lines 7-8 from:

digitalRead(pin)

to:

digitalRead(pin)

October 04, 2008, at 01:48 PM by David A. Mellis -
Changed lines 7-8 from:

digitalRead(pin)

to:

digitalRead(pin)

October 04, 2008, at 01:48 PM by David A. Mellis -
Changed lines 1-6 from:

digitalRead(pin)

What it does

Reads the value from a specified pin, it will be either HIGH or LOW.

to:

digitalRead()

Description

Reads the value from a specified digital pin, either HIGH or LOW.

Syntax

digitalRead(pin)

Changed lines 10-11 from:

pin: the number of the digital pin you want to read.

to:

pin: the number of the digital pin you want to read (int)

Changed lines 13-14 from:

Either HIGH or LOW

to:

HIGH or LOW

June 29, 2008, at 08:08 PM by David A. Mellis -
Changed lines 8-9 from:

pin: the number of the pin you want to read.

to:

pin: the number of the digital pin you want to read.

February 14, 2008, at 04:29 AM by David A. Mellis -
Changed line 40 from:
  • Description of the pins on an Arduino board
to:
January 18, 2008, at 04:15 PM by David A. Mellis -
Changed lines 8-9 from:

pin: the number of the pin you want to read. It has to be one of the digital pins of the board, thus it should be a number between 0 and 13. It could also be a variable representing a value in that range.

to:

pin: the number of the pin you want to read.

Changed lines 37-38 from:
to:

The analog input pins can be used as digital pins w/ numbers 14 (analog input 0) to 19 (analog input 5).

January 11, 2008, at 06:41 PM by David A. Mellis -
Changed line 39 from:
  • description of the pins on an Arduino board
to:
  • Description of the pins on an Arduino board
January 11, 2008, at 06:40 PM by David A. Mellis -
Added line 39:
  • description of the pins on an Arduino board
August 10, 2007, at 06:01 PM by David A. Mellis - adding a note about unconnected pins
Changed lines 34-37 from:
to:

Note

If the pin isn't connected to anything, digitalRead() can return either HIGH or LOW (and this can change randomly).

December 28, 2005, at 10:48 PM by 82.186.237.10 -
Changed lines 1-2 from:

digitalRead

to:

digitalRead(pin)

Changed lines 7-10 from:

What parametres does it take

You need to specify the number of the pin you want to read. It has to be one of the digital pins of the board, thus it should be a number between 0 and 13. It could also be a variable representing one value in that range.

This function returns

to:

Parameters

pin: the number of the pin you want to read. It has to be one of the digital pins of the board, thus it should be a number between 0 and 13. It could also be a variable representing a value in that range.

Returns

December 03, 2005, at 08:11 PM by 213.140.6.103 -
Changed line 37 from:
to:
December 03, 2005, at 07:57 PM by 213.140.6.103 -
Added lines 3-37:

What it does

Reads the value from a specified pin, it will be either HIGH or LOW.

What parametres does it take

You need to specify the number of the pin you want to read. It has to be one of the digital pins of the board, thus it should be a number between 0 and 13. It could also be a variable representing one value in that range.

This function returns

Either HIGH or LOW

Example

 
int ledPin = 13; // LED connected to digital pin 13
int inPin = 7;   // pushbutton connected to digital pin 7
int val = 0;     // variable to store the read value

void setup()
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin 13 as output
  pinMode(inPin, INPUT);      // sets the digital pin 7 as input
}

void loop()
{
  val = digitalRead(inPin);   // read the input pin
  digitalWrite(ledPin, val);    // sets the LED to the button's value
}

Sets pin 13 to the same value as the pin 7, which is an input.

See also

November 27, 2005, at 05:42 PM by 81.154.199.248 -
Added lines 1-2:

digitalRead

Share