Reference.Constants History

Hide minor edits - Show changes to markup

December 18, 2014, at 01:39 AM by Michael Shiloh - removed mention of connecting LED between two pins, one of which is high and the other low.
Changed lines 36-37 from:

In this state it can source current, e.g. light an LED that is connected through a series resistor to ground, [this is very confusing to the beginner. suggest delete it: or to another pin configured as an output, and set to LOW.]

to:

In this state it can source current, e.g. light an LED that is connected through a series resistor to ground.

Changed lines 44-45 from:

When a pin is configured to OUTPUT with pinMode(), and set to LOW with digitalWrite(), the pin is at 0 volts (both 5V and 3.3V boards). In this state it can sink current, e.g. light an LED that is connected through a series resistor to, +5 volts (or +3.3 volts), [this is very confusing to the beginner. suggest delete it: or to another pin configured as an output, and set to HIGH.

to:

When a pin is configured to OUTPUT with pinMode(), and set to LOW with digitalWrite(), the pin is at 0 volts (both 5V and 3.3V boards). In this state it can sink current, e.g. light an LED that is connected through a series resistor to +5 volts (or +3.3 volts).

December 18, 2014, at 01:36 AM by Michael Shiloh -
Changed lines 30-31 from:

A pin may also be configured as an INPUT with pinMode(), and subsequently made HIGH with digitalWrite(). This will enable the internal 20K pullup resistors, which will pull up the input pin to a HIGH reading unless it is pulled LOW by external circuitry. This is how INPUT_PULLUP works as well.

to:

A pin may also be configured as an INPUT with pinMode(), and subsequently made HIGH with digitalWrite(). This will enable the internal 20K pullup resistors, which will pull up the input pin to a HIGH reading unless it is pulled LOW by external circuitry. This is how INPUT_PULLUP works and is described below in more detail.

December 18, 2014, at 01:35 AM by Michael Shiloh -
Changed lines 23-24 from:

HIGH

to:

HIGH

Changed line 37 from:

LOW

to:

LOW

December 18, 2014, at 01:33 AM by Michael Shiloh -
Changed lines 18-19 from:

Note that the true and false constants are typed in lowercase unlike HIGH, LOW, INPUT, and OUTPUT.

to:

Note that the true and false constants are typed in lowercase unlike HIGH, LOW, INPUT, and OUTPUT.

December 18, 2014, at 01:32 AM by Michael Shiloh - used the @@ symbol to invoke monospace font for function names and constants
Changed lines 25-26 from:

The meaning of HIGH (in reference to a pin) is somewhat different depending on whether a pin is set to an INPUT or OUTPUT. When a pin is configured as an INPUT with pinMode(), and read with digitalRead(), the Arduino (Atmega) will report HIGH if:

to:

The meaning of HIGH (in reference to a pin) is somewhat different depending on whether a pin is set to an INPUT or OUTPUT. When a pin is configured as an INPUT with pinMode(), and read with digitalRead(), the Arduino (Atmega) will report HIGH if:

Changed lines 30-32 from:

A pin may also be configured as an INPUT with pinMode(), and subsequently made HIGH with digitalWrite(). This will enable the internal 20K pullup resistors, which will pull up the input pin to a HIGH reading unless it is pulled LOW by external circuitry. This is how INPUT_PULLUP works as well.

When a pin is configured to OUTPUT with pinMode(), and set to HIGH with digitalWrite(), the pin is at:

to:

A pin may also be configured as an INPUT with pinMode(), and subsequently made HIGH with digitalWrite(). This will enable the internal 20K pullup resistors, which will pull up the input pin to a HIGH reading unless it is pulled LOW by external circuitry. This is how INPUT_PULLUP works as well.

When a pin is configured to OUTPUT with pinMode(), and set to HIGH with digitalWrite(), the pin is at:

Changed line 39 from:

The meaning of LOW also has a different meaning depending on whether a pin is set to INPUT or OUTPUT. When a pin is configured as an INPUT with pinMode(), and read with digitalRead(), the Arduino (Atmega) will report LOW if:

to:

The meaning of LOW also has a different meaning depending on whether a pin is set to INPUT or OUTPUT. When a pin is configured as an INPUT with pinMode(), and read with digitalRead(), the Arduino (Atmega) will report LOW if:

Changed lines 43-58 from:

When a pin is configured to OUTPUT with pinMode(), and set to LOW with digitalWrite(), the pin is at 0 volts (both 5V and 3.3V boards). In this state it can sink current, e.g. light an LED that is connected through a series resistor to, +5 volts (or +3.3 volts), [this is very confusing to the beginner. suggest delete it: or to another pin configured as an output, and set to HIGH.

Defining Digital Pins modes: INPUT, INPUT_PULLUP, and OUTPUT

Digital pins can be used as INPUT, INPUT_PULLUP, or OUTPUT. Changing a pin with pinMode() changes the electrical behavior of the pin.

Pins Configured as INPUT

Arduino (Atmega) pins configured as INPUT with pinMode() are said to be in a high-impedance state. Pins configured as INPUT make extremely small demands on the circuit that they are sampling, equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor, but not powering an LED.

If you have your pin configured as an INPUT, and are reading a switch, when the switch is in the open state the input pin will be "floating", resulting in unpredictable results. In order to assure a proper reading when the switch is open, a pull-up or pull-down resistor must be used. The purpose of this resistor is to pull the pin to a known state when the switch is open. A 10 K ohm resistor is usually chosen, as it is a low enough value to reliably prevent a floating input, and at the same time a high enough value to not not draw too much current when the switch is closed. See the Digital Read Serial tutorial for more information.

If a pull-down resistor is used, the input pin will be LOW when the switch is open and HIGH when the switch is closed.

If a pull-up resistor is used, the input pin will be HIGH when the switch is open and LOW when the switch is closed.

to:

When a pin is configured to OUTPUT with pinMode(), and set to LOW with digitalWrite(), the pin is at 0 volts (both 5V and 3.3V boards). In this state it can sink current, e.g. light an LED that is connected through a series resistor to, +5 volts (or +3.3 volts), [this is very confusing to the beginner. suggest delete it: or to another pin configured as an output, and set to HIGH.

Defining Digital Pins modes: INPUT, INPUT_PULLUP, and OUTPUT

Digital pins can be used as INPUT, INPUT_PULLUP, or OUTPUT. Changing a pin with pinMode() changes the electrical behavior of the pin.

Pins Configured as INPUT

Arduino (Atmega) pins configured as INPUT with pinMode() are said to be in a high-impedance state. Pins configured as INPUT make extremely small demands on the circuit that they are sampling, equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor.

If you have your pin configured as an INPUT, and are reading a switch, when the switch is in the open state the input pin will be "floating", resulting in unpredictable results. In order to assure a proper reading when the switch is open, a pull-up or pull-down resistor must be used. The purpose of this resistor is to pull the pin to a known state when the switch is open. A 10 K ohm resistor is usually chosen, as it is a low enough value to reliably prevent a floating input, and at the same time a high enough value to not not draw too much current when the switch is closed. See the Digital Read Serial tutorial for more information.

If a pull-down resistor is used, the input pin will be LOW when the switch is open and HIGH when the switch is closed.

If a pull-up resistor is used, the input pin will be HIGH when the switch is open and LOW when the switch is closed.

Changed lines 61-62 from:

The Atmega microcontroller on the Arduino has internal pull-up resistors (resistors that connect to power internally) that you can access. If you prefer to use these instead of external pull-up resistors, you can use the INPUT_PULLUP argument in pinMode().

to:

The Atmega microcontroller on the Arduino has internal pull-up resistors (resistors that connect to power internally) that you can access. If you prefer to use these instead of external pull-up resistors, you can use the INPUT_PULLUP argument in pinMode().

Changed lines 65-66 from:

Pins configured as inputs with either INPUT or INPUT_PULLUP can be damaged or destroyed if they are connected to voltages below ground (negative voltages) or above the positive power rail (5V or 3V).

to:

Pins configured as inputs with either INPUT or INPUT_PULLUP can be damaged or destroyed if they are connected to voltages below ground (negative voltages) or above the positive power rail (5V or 3V).

Changed lines 69-72 from:

Pins configured as OUTPUT with pinMode() are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can source (provide current) or sink (absorb current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LEDs because LEDs typically use less than 40 mA. Loads greater than 40 mA (e.g. motors) will require a transistor or other interface circuitry.

Pins configured as outputs can be damaged or destroyed if they are connected directly to either ground or positive power rails.

to:

Pins configured as OUTPUT with pinMode() are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can source (provide current) or sink (absorb current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LEDs because LEDs typically use less than 40 mA. Loads greater than 40 mA (e.g. motors) will require a transistor or other interface circuitry.

Pins configured as outputs can be damaged or destroyed if they are connected to either the ground or positive power rails.

Changed lines 75-78 from:

Most Arduino boards have a pin connected to an on-board LED in series with a resistor. The constant LED_BUILTIN is the number of the pin to which the on-board LED is connected. Most boards have this LED connected to digital pin 13.

to:

Most Arduino boards have a pin connected to an on-board LED in series with a resistor. The constant LED_BUILTIN is the number of the pin to which the on-board LED is connected. Most boards have this LED connected to digital pin 13.

December 18, 2014, at 01:25 AM by Michael Shiloh -
Changed lines 11-13 from:

false is the easier of the two to define. false is defined as 0 (zero).

to:

false is the easier of the two to define. false is defined as 0 (zero).

Changed lines 16-20 from:

true is often said to be defined as 1, which is correct, but true has a wider definition. Any integer which is non-zero is true, in a Boolean sense. So -1, 2 and -200 are all defined as true, too, in a Boolean sense.

Note that the true and false constants are typed in lowercase unlike HIGH, LOW, INPUT, and OUTPUT.

Defining Pin Levels: HIGH and LOW

to:

true is often said to be defined as 1, which is correct, but true has a wider definition. Any integer which is non-zero is true, in a Boolean sense. So -1, 2 and -200 are all defined as true, too, in a Boolean sense.

Note that the true and false constants are typed in lowercase unlike HIGH, LOW, INPUT, and OUTPUT.

Defining Pin Levels: HIGH and LOW

December 18, 2014, at 01:23 AM by Michael Shiloh -
Changed lines 3-4 from:

Constants are predefined expressions in the Arduino language. They are used to make the programs easier to read. We classify constants in groups.

to:

Constants are predefined expressions in the Arduino language. They are used to make the programs easier to read. We classify constants in groups:

December 18, 2014, at 01:21 AM by Michael Shiloh -
Changed lines 5-6 from:

Defining Logical Levels, true and false (Boolean Constants)

to:

Defining Logical Levels: true and false (Boolean Constants)

Changed line 20 from:

Defining Pin Levels, HIGH and LOW

to:

Defining Pin Levels: HIGH and LOW

Changed lines 45-46 from:

Defining Digital Pins, INPUT, INPUT_PULLUP, and OUTPUT

to:

Defining Digital Pins modes: INPUT, INPUT_PULLUP, and OUTPUT

Changed lines 73-74 from:

LED_BUILTIN

to:

Defining built-ins: LED_BUILTIN

December 18, 2014, at 01:20 AM by Michael Shiloh - much rewording, simplification, and standardizing
Changed lines 18-19 from:

Note that the true and false constants are typed in lowercase unlike HIGH, LOW, INPUT, & OUTPUT.

to:

Note that the true and false constants are typed in lowercase unlike HIGH, LOW, INPUT, and OUTPUT.

Changed line 26 from:

When a pin is configured as an INPUT with pinMode, and read with digitalRead, the microcontroller will report HIGH if:

to:

When a pin is configured as an INPUT with pinMode(), and read with digitalRead(), the Arduino (Atmega) will report HIGH if:

Changed lines 30-32 from:

A pin may also be configured as an INPUT with pinMode, and subsequently made HIGH with digitalWrite, this will set the internal 20K pullup resistors, which will steer the input pin to a HIGH reading unless it is pulled LOW by external circuitry. This is how INPUT_PULLUP works as well

When a pin is configured to OUTPUT with pinMode, and set to HIGH with digitalWrite, the pin is at:

to:

A pin may also be configured as an INPUT with pinMode(), and subsequently made HIGH with digitalWrite(). This will enable the internal 20K pullup resistors, which will pull up the input pin to a HIGH reading unless it is pulled LOW by external circuitry. This is how INPUT_PULLUP works as well.

When a pin is configured to OUTPUT with pinMode(), and set to HIGH with digitalWrite(), the pin is at:

Changed lines 35-36 from:

In this state it can source current, e.g. light an LED that is connected through a series resistor to ground, or to another pin configured as an output, and set to LOW.

to:

In this state it can source current, e.g. light an LED that is connected through a series resistor to ground, [this is very confusing to the beginner. suggest delete it: or to another pin configured as an output, and set to LOW.]

Changed line 39 from:

The meaning of LOW also has a different meaning depending on whether a pin is set to INPUT or OUTPUT. When a pin is configured as an INPUT with pinMode, and read with digitalRead, the microcontroller will report LOW if:

to:

The meaning of LOW also has a different meaning depending on whether a pin is set to INPUT or OUTPUT. When a pin is configured as an INPUT with pinMode(), and read with digitalRead(), the Arduino (Atmega) will report LOW if:

Changed lines 43-44 from:

When a pin is configured to OUTPUT with pinMode, and set to LOW with digitalWrite, the pin is at 0 volts (both 5V and 3.3V boards). In this state it can sink current, e.g. light an LED that is connected through a series resistor to, +5 volts (or +3.3 volts), or to another pin configured as an output, and set to HIGH.

to:

When a pin is configured to OUTPUT with pinMode(), and set to LOW with digitalWrite(), the pin is at 0 volts (both 5V and 3.3V boards). In this state it can sink current, e.g. light an LED that is connected through a series resistor to, +5 volts (or +3.3 volts), [this is very confusing to the beginner. suggest delete it: or to another pin configured as an output, and set to HIGH.

Changed lines 53-54 from:

If you have your pin configured as an INPUT, you will want the pin to have a reference to ground, often accomplished with a pull-down resistor (a resistor going to ground) as described in the Digital Read Serial tutorial.

to:

If you have your pin configured as an INPUT, and are reading a switch, when the switch is in the open state the input pin will be "floating", resulting in unpredictable results. In order to assure a proper reading when the switch is open, a pull-up or pull-down resistor must be used. The purpose of this resistor is to pull the pin to a known state when the switch is open. A 10 K ohm resistor is usually chosen, as it is a low enough value to reliably prevent a floating input, and at the same time a high enough value to not not draw too much current when the switch is closed. See the Digital Read Serial tutorial for more information.

If a pull-down resistor is used, the input pin will be LOW when the switch is open and HIGH when the switch is closed.

If a pull-up resistor is used, the input pin will be HIGH when the switch is open and LOW when the switch is closed.

Changed lines 61-62 from:

The Atmega chip on the Arduino has internal pull-up resistors (resistors that connect to power internally) that you can access. If you prefer to use these instead of external pull-down resistors, you can use the INPUT_PULLUP argument in pinMode(). This effectively inverts the behavior, where HIGH means the sensor is off, and LOW means the sensor is on. See the Input Pullup Serial tutorial for an example of this in use.

to:

The Atmega microcontroller on the Arduino has internal pull-up resistors (resistors that connect to power internally) that you can access. If you prefer to use these instead of external pull-up resistors, you can use the INPUT_PULLUP argument in pinMode().

See the Input Pullup Serial tutorial for an example of this in use.

Pins configured as inputs with either INPUT or INPUT_PULLUP can be damaged or destroyed if they are connected to voltages below ground (negative voltages) or above the positive power rail (5V or 3V).

Changed lines 69-70 from:

Pins configured as OUTPUT with pinMode() are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can source (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LED's but useless for reading sensors. Pins configured as outputs can also be damaged or destroyed if short circuited to either ground or positive power rails. The amount of current provided by an Atmega pin is also not enough to power most relays or motors, and some interface circuitry will be required.

to:

Pins configured as OUTPUT with pinMode() are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can source (provide current) or sink (absorb current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LEDs because LEDs typically use less than 40 mA. Loads greater than 40 mA (e.g. motors) will require a transistor or other interface circuitry.

Pins configured as outputs can be damaged or destroyed if they are connected directly to either ground or positive power rails.

Changed lines 75-78 from:

Most Arduino boards have a pin connected to an on-board LED in series with a resistor. LED_BUILTIN is a drop-in replacement for manually declaring this pin as a variable. Most boards have this LED connected to digital pin 13.

to:

Most Arduino boards have a pin connected to an on-board LED in series with a resistor. The constant LED_BUILTIN is the number of the pin to which the on-board LED is connected. Most boards have this LED connected to digital pin 13.

December 18, 2014, at 12:30 AM by Michael Shiloh - constants are expressions, not variables
Changed lines 3-4 from:

Constants are predefined variables in the Arduino language. They are used to make the programs easier to read. We classify constants in groups.

to:

Constants are predefined expressions in the Arduino language. They are used to make the programs easier to read. We classify constants in groups.

December 04, 2014, at 10:31 AM by Arturo -
Changed lines 26-27 from:

When a pin is configured as an INPUT with pinMode, and read with digitalRead, the microcontroller will report HIGH if a voltage of 3 volts or more is present at the pin.

to:

When a pin is configured as an INPUT with pinMode, and read with digitalRead, the microcontroller will report HIGH if:

  • a voltage greater than 3 volts is present at the pin (5V boards);
  • a voltage greater than 2 volts is present at the pin (3.3V boards);
Changed lines 32-33 from:

When a pin is configured to OUTPUT with pinMode, and set to HIGH with digitalWrite, the pin is at 5 volts. In this state it can source current, e.g. light an LED that is connected through a series resistor to ground, or to another pin configured as an output, and set to LOW.

to:

When a pin is configured to OUTPUT with pinMode, and set to HIGH with digitalWrite, the pin is at:

  • 5 volts (5V boards);
  • 3.3 volts (3.3V boards);

In this state it can source current, e.g. light an LED that is connected through a series resistor to ground, or to another pin configured as an output, and set to LOW.

Changed lines 39-42 from:

The meaning of LOW also has a different meaning depending on whether a pin is set to INPUT or OUTPUT. When a pin is configured as an INPUT with pinMode, and read with digitalRead, the microcontroller will report LOW if a voltage of 2 volts or less is present at the pin.

When a pin is configured to OUTPUT with pinMode, and set to LOW with digitalWrite, the pin is at 0 volts. In this state it can sink current, e.g. light an LED that is connected through a series resistor to, +5 volts, or to another pin configured as an output, and set to HIGH.

to:

The meaning of LOW also has a different meaning depending on whether a pin is set to INPUT or OUTPUT. When a pin is configured as an INPUT with pinMode, and read with digitalRead, the microcontroller will report LOW if:

  • a voltage less than 3 volts is present at the pin (5V boards);
  • a voltage less than 2 volts is present at the pin (3.3V boards);

When a pin is configured to OUTPUT with pinMode, and set to LOW with digitalWrite, the pin is at 0 volts (both 5V and 3.3V boards). In this state it can sink current, e.g. light an LED that is connected through a series resistor to, +5 volts (or +3.3 volts), or to another pin configured as an output, and set to HIGH.

Changed lines 61-62 from:

Pins configured as OUTPUT with pinMode() are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can source (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LED's but useless for reading sensors. Pins configured as outputs can also be damaged or destroyed if short circuited to either ground or 5 volt power rails. The amount of current provided by an Atmega pin is also not enough to power most relays or motors, and some interface circuitry will be required.

to:

Pins configured as OUTPUT with pinMode() are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can source (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LED's but useless for reading sensors. Pins configured as outputs can also be damaged or destroyed if short circuited to either ground or positive power rails. The amount of current provided by an Atmega pin is also not enough to power most relays or motors, and some interface circuitry will be required.

Changed lines 73-79 from:
to:
February 11, 2014, at 04:57 AM by Scott Fitzgerald - added information about LED_BUILTIN
Changed lines 56-61 from:
to:

LED_BUILTIN

Most Arduino boards have a pin connected to an on-board LED in series with a resistor. LED_BUILTIN is a drop-in replacement for manually declaring this pin as a variable. Most boards have this LED connected to digital pin 13.

Deleted line 72:
May 24, 2012, at 10:53 PM by Scott Fitzgerald -
Changed lines 50-51 from:

The Atmega chip on the Arduino has internal pull-up resistors (resistors that connect to power internally) that you can access. If you prefer to use these instead of external pull-down resistors, you can use the INPUT_PULLUP argument in pinMode(). This effectively inverts the behavior, where HIGH means the sensor is off, and LOW means the sensor is on. See the Digital Input Pullup? tutorial for an example of this in use.

to:

The Atmega chip on the Arduino has internal pull-up resistors (resistors that connect to power internally) that you can access. If you prefer to use these instead of external pull-down resistors, you can use the INPUT_PULLUP argument in pinMode(). This effectively inverts the behavior, where HIGH means the sensor is off, and LOW means the sensor is on. See the Input Pullup Serial tutorial for an example of this in use.

Deleted line 68:
May 07, 2012, at 05:39 PM by Tom Igoe -
May 07, 2012, at 05:39 PM by Tom Igoe -
Changed lines 40-41 from:

Digital pins can be used as INPUT, INPUT_PULLUP, or OUTPUT. Changing a pin with pinMode() drastically changes the electrical behavior of the pin.

to:

Digital pins can be used as INPUT, INPUT_PULLUP, or OUTPUT. Changing a pin with pinMode() changes the electrical behavior of the pin.

Changed lines 44-45 from:

Arduino (Atmega) pins configured as INPUT with pinMode() are said to be in a high-impedance state. One way of explaining this is that pins configured as INPUT make extremely small demands on the circuit that they are sampling, say equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor, but not powering an LED.

to:

Arduino (Atmega) pins configured as INPUT with pinMode() are said to be in a high-impedance state. Pins configured as INPUT make extremely small demands on the circuit that they are sampling, equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor, but not powering an LED.

March 28, 2012, at 03:00 PM by Scott Fitzgerald -
Changed lines 42-43 from:

Pins Configured as Inputs

to:

Pins Configured as INPUT

Changed lines 48-49 from:

The Atmega chip on the Arduino has internal pull-up resistors (resistors that connect to power internally) that you can access. If you prefer to use these instead of external pull-down resistors, you can use the INPUT_PULLUP argument in pinMode(). This effectively inverts the behavior, where HIGH means the sensor is off, and LOW means the sensor is on.

to:

Pins Configured as INPUT_PULLUP

The Atmega chip on the Arduino has internal pull-up resistors (resistors that connect to power internally) that you can access. If you prefer to use these instead of external pull-down resistors, you can use the INPUT_PULLUP argument in pinMode(). This effectively inverts the behavior, where HIGH means the sensor is off, and LOW means the sensor is on. See the Digital Input Pullup? tutorial for an example of this in use.

Deleted line 69:
March 14, 2012, at 11:50 PM by Scott Fitzgerald - INPUT_PULLUP work
Changed lines 46-49 from:

Unfortunately pins with high-impedance state makes them affected to catching noise and picking up false signals. You can avoid this effect by placing a resistor between the Vcc and the input pin. The resistor will normally hold the input pin at logic HIGH. Any external source can pull the voltage down to LOW when required.

The Atmega chip on the Arduino has internal pull-up resistors. If you prefer to use these instead of external resistors, you can use the INPUT_PULLUP argument in pinMode().

to:

If you have your pin configured as an INPUT, you will want the pin to have a reference to ground, often accomplished with a pull-down resistor (a resistor going to ground) as described in the Digital Read Serial tutorial.

The Atmega chip on the Arduino has internal pull-up resistors (resistors that connect to power internally) that you can access. If you prefer to use these instead of external pull-down resistors, you can use the INPUT_PULLUP argument in pinMode(). This effectively inverts the behavior, where HIGH means the sensor is off, and LOW means the sensor is on.

March 14, 2012, at 07:34 PM by Scott Fitzgerald - added information on INPUT_PULLUP
Changed lines 16-19 from:

true is often said to be defined as 1, which is correct, but true has a wider definition. Any integer which is non-zero is TRUE, in a Boolean sense. So -1, 2 and -200 are all defined as true, too, in a Boolean sense.

Note that the true and false constants are typed in lowercase unlike HIGH, LOW, INPUT, & OUTPUT.

to:

true is often said to be defined as 1, which is correct, but true has a wider definition. Any integer which is non-zero is true, in a Boolean sense. So -1, 2 and -200 are all defined as true, too, in a Boolean sense.

Note that the true and false constants are typed in lowercase unlike HIGH, LOW, INPUT, & OUTPUT.

Changed lines 28-29 from:

A pin may also be configured as an INPUT with pinMode, and subsequently made HIGH with digitalWrite, this will set the internal 20K pullup resistors, which will steer the input pin to a HIGH reading unless it is pulled LOW by external circuitry.

to:

A pin may also be configured as an INPUT with pinMode, and subsequently made HIGH with digitalWrite, this will set the internal 20K pullup resistors, which will steer the input pin to a HIGH reading unless it is pulled LOW by external circuitry. This is how INPUT_PULLUP works as well

Changed lines 38-41 from:

Defining Digital Pins, INPUT and OUTPUT

Digital pins can be used either as INPUT or OUTPUT. Changing a pin from INPUT to OUTPUT with pinMode() drastically changes the electrical behavior of the pin.

to:

Defining Digital Pins, INPUT, INPUT_PULLUP, and OUTPUT

Digital pins can be used as INPUT, INPUT_PULLUP, or OUTPUT. Changing a pin with pinMode() drastically changes the electrical behavior of the pin.

Changed lines 48-49 from:

The pull-up resistor could be an external resistor that you connect externally or since the Arduino (Atmega) has already included internal pull-up resistors, you can enable them by choosing the INPUT_PULLUP argument inside the pinMode() function.

to:

The Atmega chip on the Arduino has internal pull-up resistors. If you prefer to use these instead of external resistors, you can use the INPUT_PULLUP argument in pinMode().

Deleted line 68:
March 14, 2012, at 01:00 PM by Federico -
Changed lines 40-41 from:

Digital pins can be used either as INPUT or OUTPUT. Changing a pin from INPUT TO OUTPUT with pinMode() drastically changes the electrical behavior of the pin.

to:

Digital pins can be used either as INPUT or OUTPUT. Changing a pin from INPUT to OUTPUT with pinMode() drastically changes the electrical behavior of the pin.

Added lines 46-49:

Unfortunately pins with high-impedance state makes them affected to catching noise and picking up false signals. You can avoid this effect by placing a resistor between the Vcc and the input pin. The resistor will normally hold the input pin at logic HIGH. Any external source can pull the voltage down to LOW when required.

The pull-up resistor could be an external resistor that you connect externally or since the Arduino (Atmega) has already included internal pull-up resistors, you can enable them by choosing the INPUT_PULLUP argument inside the pinMode() function.

October 18, 2008, at 04:48 PM by Paul Badger -
Added lines 28-29:

A pin may also be configured as an INPUT with pinMode, and subsequently made HIGH with digitalWrite, this will set the internal 20K pullup resistors, which will steer the input pin to a HIGH reading unless it is pulled LOW by external circuitry.

October 18, 2008, at 04:41 PM by Paul Badger -
Changed lines 34-35 from:

When a pin is configured to OUTPUT with pinMode, and set to LOW with digitalWrite, the pin is at 0 volts. In this state it can sink current, i.e. light an LED that is connected through a series resistor to, +5 volts, or to another pin configured as an output, and set to HIGH.

to:

When a pin is configured to OUTPUT with pinMode, and set to LOW with digitalWrite, the pin is at 0 volts. In this state it can sink current, e.g. light an LED that is connected through a series resistor to, +5 volts, or to another pin configured as an output, and set to HIGH.

May 10, 2008, at 06:57 AM by David A. Mellis -
Changed lines 26-27 from:

When a pin is configured as an INPUT with pinMode, and read with digitalRead, the microcontroller will report HIGH (0) if a voltage of 3 volts or more is present at the pin.

to:

When a pin is configured as an INPUT with pinMode, and read with digitalRead, the microcontroller will report HIGH if a voltage of 3 volts or more is present at the pin.

Changed lines 32-33 from:

The meaning of LOW also has a different meaning depending on whether a pin is set to INPUT or OUTPUT. When a pin is configured as an INPUT with pinMode, and read with digitalRead, the microcontroller will report LOW (0) if a voltage of 2 volts or less is present at the pin.

to:

The meaning of LOW also has a different meaning depending on whether a pin is set to INPUT or OUTPUT. When a pin is configured as an INPUT with pinMode, and read with digitalRead, the microcontroller will report LOW if a voltage of 2 volts or less is present at the pin.

March 29, 2008, at 05:43 PM by David A. Mellis -
Changed lines 6-7 from:

There are two boolean constants defined in the C language, upon which Arduino is based: TRUE and FALSE.

to:

There are two constants used to represent truth and falsity in the Arduino language: true, and false.

March 28, 2008, at 02:48 AM by Paul Badger -
Changed lines 41-42 from:

Arduino (Atmega) pins configured as INPUT are said to be in a high-impedance state. One way of explaining this is that pins configured as INPUT make extremely small demands on the circuit that they are sampling, say equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor, but not powering an LED.

to:

Arduino (Atmega) pins configured as INPUT with pinMode() are said to be in a high-impedance state. One way of explaining this is that pins configured as INPUT make extremely small demands on the circuit that they are sampling, say equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor, but not powering an LED.

Changed lines 45-47 from:

Pins configured as OUTPUT are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can source (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LED's but useless for connecting to sensors. Pins configured as outputs can also be damaged or destroyed if short circuited to either ground or 5 volt power rails. The amount of current provided by an Atmega pin is also not enough to power most relays or motors, and some interface circuitry will be required.

to:

Pins configured as OUTPUT with pinMode() are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can source (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LED's but useless for reading sensors. Pins configured as outputs can also be damaged or destroyed if short circuited to either ground or 5 volt power rails. The amount of current provided by an Atmega pin is also not enough to power most relays or motors, and some interface circuitry will be required.

March 28, 2008, at 02:45 AM by Paul Badger -
Changed lines 27-28 from:

When an output pin is configured to OUTPUT with pinMode, and set to HIGH with digitalWrite, the pin is at 5 volts. In this state it can source current, i.e. light an LED that is connected through a series resistor to ground, or to another pin configured as an output, and set to LOW.

to:

When a pin is configured to OUTPUT with pinMode, and set to HIGH with digitalWrite, the pin is at 5 volts. In this state it can source current, e.g. light an LED that is connected through a series resistor to ground, or to another pin configured as an output, and set to LOW.

Changed lines 31-33 from:

The meaning of LOW also has a different meaning depending on whether a pin is set to INPUT or OUTPUT. When a pin is configured as an INPUT with pinMode, and read with digitalRead, the microcontroller will report LOW (0) if a voltage of 2 volts or less is present at the pin.

to:

The meaning of LOW also has a different meaning depending on whether a pin is set to INPUT or OUTPUT. When a pin is configured as an INPUT with pinMode, and read with digitalRead, the microcontroller will report LOW (0) if a voltage of 2 volts or less is present at the pin.

March 28, 2008, at 02:43 AM by Paul Badger -
Changed line 24 from:

The meaning of HIGH has a somewhat different meaning depending on whether a pin is set to an INPUT or OUTPUT.

to:

The meaning of HIGH (in reference to a pin) is somewhat different depending on whether a pin is set to an INPUT or OUTPUT.

March 18, 2008, at 04:40 AM by Paul Badger -
Added lines 8-9:

false

Changed lines 12-13 from:

true is often said to be defined as 1, which is correct, but true has a wider definition. Any integer which is non-zero is TRUE, in a Boolean sense. So -1, 2 and -200 are all defined as true, too, in a Boolean sense. Consequently true is often said to be defined as "non-zero".

to:

true

true is often said to be defined as 1, which is correct, but true has a wider definition. Any integer which is non-zero is TRUE, in a Boolean sense. So -1, 2 and -200 are all defined as true, too, in a Boolean sense.

Deleted line 18:
March 17, 2008, at 05:18 PM by Paul Badger -
Changed line 27 from:

The meaning of LOW also has a different meaning depending on whether the pin is set to INPUT or OUTPUT.

to:

The meaning of LOW also has a different meaning depending on whether a pin is set to INPUT or OUTPUT.

March 17, 2008, at 05:16 PM by Paul Badger -
Changed lines 10-11 from:

true is often said to be defined as 1, which is correct, but true has a wider definition. Any integer which is non-zero is TRUE, in a Boolean sense. So -1, 2 and -200 are all defined as true, too, in a Boolean sense. Consequently true is often said to be defined as non-zero.

to:

true is often said to be defined as 1, which is correct, but true has a wider definition. Any integer which is non-zero is TRUE, in a Boolean sense. So -1, 2 and -200 are all defined as true, too, in a Boolean sense. Consequently true is often said to be defined as "non-zero".

March 17, 2008, at 05:16 PM by Paul Badger -
Changed lines 10-11 from:

true is often said to be defined as 1, which is correct, but true has a wider definition. Any integer which is non-zero is TRUE, in a Boolean sense. So -1, 2 and -200 are all defined as true, too, in a Boolean sense.

to:

true is often said to be defined as 1, which is correct, but true has a wider definition. Any integer which is non-zero is TRUE, in a Boolean sense. So -1, 2 and -200 are all defined as true, too, in a Boolean sense. Consequently true is often said to be defined as non-zero.

March 17, 2008, at 05:14 PM by Paul Badger -
Changed line 27 from:

The meaning of LOW has a somewhat different meaning depending on whether the pin is set to INPUT or OUTPUT.

to:

The meaning of LOW also has a different meaning depending on whether the pin is set to INPUT or OUTPUT.

March 17, 2008, at 05:12 PM by Paul Badger -
Changed lines 18-19 from:

HIGH

to:

HIGH

Changed lines 25-26 from:

LOW

to:

LOW

March 17, 2008, at 05:12 PM by Paul Badger -
Changed line 5 from:

Defining Logical Levels, TRUE and FALSE (Boolean Constants)

to:

Defining Logical Levels, true and false (Boolean Constants)

Changed lines 8-9 from:

FALSE is the easier of the two to define. FALSE is defined as 0 (zero).

to:

false is the easier of the two to define. false is defined as 0 (zero).

Changed lines 12-14 from:
to:

Note that the true and false constants are typed in lowercase unlike HIGH, LOW, INPUT, & OUTPUT.

March 17, 2008, at 05:08 PM by Paul Badger -
Changed lines 5-12 from:

Defining Logical Levels, true and false (Boolean Constants)

There are two boolean constants defined in the C language, upon which Arduino is based: true and false.

false is the easier of the two to define. false is defined as 0 (zero).

true is often said to be defined as 1, which is true, but true has a wider definition. Any integer which is non-zero is TRUE, in a Boolean sense. So -1, 2 and -200 are all defined as true, too, in a Boolean sense.

to:

Defining Logical Levels, TRUE and FALSE (Boolean Constants)

There are two boolean constants defined in the C language, upon which Arduino is based: TRUE and FALSE.

FALSE is the easier of the two to define. FALSE is defined as 0 (zero).

true is often said to be defined as 1, which is correct, but true has a wider definition. Any integer which is non-zero is TRUE, in a Boolean sense. So -1, 2 and -200 are all defined as true, too, in a Boolean sense.

Changed lines 16-18 from:

HIGH represents the programming equivalent to 5 volts. When reading the value at a digital pin if there is 3 volts or more at the input pin, the microprocessor will understand it as HIGH. This constant is also represented by the integer number 1.

LOW represents the programming equivalent to 0 volts. The meaning of LOW has a somewhat different meaning depending on whether the pin is set to an INPUT or OUTPUT.

to:

HIGH The meaning of HIGH has a somewhat different meaning depending on whether a pin is set to an INPUT or OUTPUT. When a pin is configured as an INPUT with pinMode, and read with digitalRead, the microcontroller will report HIGH (0) if a voltage of 3 volts or more is present at the pin.

When an output pin is configured to OUTPUT with pinMode, and set to HIGH with digitalWrite, the pin is at 5 volts. In this state it can source current, i.e. light an LED that is connected through a series resistor to ground, or to another pin configured as an output, and set to LOW.

LOW The meaning of LOW has a somewhat different meaning depending on whether the pin is set to INPUT or OUTPUT.

Changed lines 26-27 from:

When an output pin is configured to OUTPUT with pinMode, and set to LOW with digitalWrite, the pin is at 0 volts. In this state it can sink current, i.e. light an LED that is connected through a series resistor to +5 volts, or to another pin configured as an output, and set to HIGH.

to:

When a pin is configured to OUTPUT with pinMode, and set to LOW with digitalWrite, the pin is at 0 volts. In this state it can sink current, i.e. light an LED that is connected through a series resistor to, +5 volts, or to another pin configured as an output, and set to HIGH.

Changed lines 38-40 from:

Pins configured as OUTPUT are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can sorce (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LED's but useless for connecting to sensors. Pins configured as outputs can also be damaged or destroyed if short circuited to either ground or 5 volt power rails.

to:

Pins configured as OUTPUT are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can source (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LED's but useless for connecting to sensors. Pins configured as outputs can also be damaged or destroyed if short circuited to either ground or 5 volt power rails. The amount of current provided by an Atmega pin is also not enough to power most relays or motors, and some interface circuitry will be required.

March 17, 2008, at 04:59 PM by Paul Badger -
Changed lines 21-22 from:

Setting an output pin to low with digitalWrite, means that the pin is at 0 volts. In this state it can sink current, i.e. light an LED that is connected through a series resistor to +5 volts, or to another pin configured as an output, and set to HIGH.

to:

When an output pin is configured to OUTPUT with pinMode, and set to LOW with digitalWrite, the pin is at 0 volts. In this state it can sink current, i.e. light an LED that is connected through a series resistor to +5 volts, or to another pin configured as an output, and set to HIGH.

March 17, 2008, at 04:57 PM by Paul Badger -
Changed lines 18-20 from:

LOW represents the programming equivalent to 0 volts. The meaning of LOW has a somewhat different meaning, depending on whether the pin is set to an input or output. When reading a pin is set to an input with digitalRead, if a voltage of 2 volts or less is present at the pin, the microcontroller will report LOW (0).

to:

LOW represents the programming equivalent to 0 volts. The meaning of LOW has a somewhat different meaning depending on whether the pin is set to an INPUT or OUTPUT. When a pin is configured as an INPUT with pinMode, and read with digitalRead, the microcontroller will report LOW (0) if a voltage of 2 volts or less is present at the pin.

March 17, 2008, at 04:55 PM by Paul Badger -
Changed lines 18-19 from:

LOW is representing the programming equivalent to 0 volts. When reading the value at a digital pin, if we get 2 volts or less, the microprocessor will understand it as LOW. This constant if also represented by the integer number 0.

to:

LOW represents the programming equivalent to 0 volts. The meaning of LOW has a somewhat different meaning, depending on whether the pin is set to an input or output. When reading a pin is set to an input with digitalRead, if a voltage of 2 volts or less is present at the pin, the microcontroller will report LOW (0).

Setting an output pin to low with digitalWrite, means that the pin is at 0 volts. In this state it can sink current, i.e. light an LED that is connected through a series resistor to +5 volts, or to another pin configured as an output, and set to HIGH.

March 17, 2008, at 04:45 PM by Paul Badger -
Changed line 5 from:

Defining Logical Levels, true and false (Boolean Constants)

to:

Defining Logical Levels, true and false (Boolean Constants)

Changed line 13 from:

Defining Pin Levels, HIGH and LOW

to:

Defining Pin Levels, HIGH and LOW

Changed lines 20-21 from:

Defining Digital Pins, INPUT and OUTPUT

to:

Defining Digital Pins, INPUT and OUTPUT

Changed lines 28-29 from:
Pins Configured as Outputs
to:

Pins Configured as Outputs

March 17, 2008, at 04:45 PM by Paul Badger -
Changed lines 24-25 from:
Pins Configured as Inputs
to:

Pins Configured as Inputs

March 17, 2008, at 04:44 PM by Paul Badger -
Changed lines 24-25 from:

Pins Configured as Inputs

to:
Pins Configured as Inputs
Changed lines 28-29 from:

Pins Configured as Outputs

to:
Pins Configured as Outputs
March 17, 2008, at 04:14 PM by Paul Badger -
Changed line 5 from:

Defining Logical Levels, true and false (Boolean Constants)

to:

Defining Logical Levels, true and false (Boolean Constants)

Changed line 13 from:

Defining Pin Levels, HIGH and LOW

to:

Defining Pin Levels, HIGH and LOW

Changed lines 20-21 from:

Defining Digital Pins, INPUT and OUTPUT

to:

Defining Digital Pins, INPUT and OUTPUT

January 21, 2008, at 05:57 PM by David A. Mellis -
Changed lines 16-19 from:

HIGH represents the programming equivalent to 5 volts. When reading the value at a digital pin if there is 3 volts or more at the input pin, the microprocessor will understand it as HIGH. This constant is also represented by the integer number 1, and also the truth level TRUE.

LOW is representing the programming equivalent to 0 volts. When reading the value at a digital pin, if we get 2 volts or less, the microprocessor will understand it as LOW. This constant if also represented by the integer number 0, and also the truth level FALSE.

to:

HIGH represents the programming equivalent to 5 volts. When reading the value at a digital pin if there is 3 volts or more at the input pin, the microprocessor will understand it as HIGH. This constant is also represented by the integer number 1.

LOW is representing the programming equivalent to 0 volts. When reading the value at a digital pin, if we get 2 volts or less, the microprocessor will understand it as LOW. This constant if also represented by the integer number 0.

January 21, 2008, at 05:57 PM by David A. Mellis -
Changed lines 5-12 from:

Defining Logical Levels, TRUE and FALSE (Boolean Constants)

There are two boolean constants defined in the C language, upon which Arduino is based: TRUE and FALSE.

FALSE is the easier of the two to define. FALSE is defined as 0 (zero).

TRUE is often said to be defined as 1, which is true, but TRUE has a wider definition. Any integer which is non-zero is TRUE, in a Boolean sense. So -1, 2 and -200 are all defined as TRUE, too, in a Boolean sense.

to:

Defining Logical Levels, true and false (Boolean Constants)

There are two boolean constants defined in the C language, upon which Arduino is based: true and false.

false is the easier of the two to define. false is defined as 0 (zero).

true is often said to be defined as 1, which is true, but true has a wider definition. Any integer which is non-zero is TRUE, in a Boolean sense. So -1, 2 and -200 are all defined as true, too, in a Boolean sense.

June 10, 2007, at 03:47 AM by Paul Badger -
June 10, 2007, at 03:44 AM by Paul Badger -
Changed line 5 from:

Defining Logical Levels (Boolean Constants)

to:

Defining Logical Levels, TRUE and FALSE (Boolean Constants)

Changed line 13 from:

Defining Pin Levels

to:

Defining Pin Levels, HIGH and LOW

Changed lines 20-21 from:

Defining Digital Pins

to:

Defining Digital Pins, INPUT and OUTPUT

June 10, 2007, at 03:33 AM by Paul Badger -
Changed lines 30-33 from:

Pins configured as OUTPUT are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can sorce (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LED's but useless for connecting to sensors. Pins configured as outputs can also be damaged or destroyed if short circuited to either ground or 5 volt power rails. For this reason it is a good idea to connect output pins with 470Ω or 1k resistors.

to:

Pins configured as OUTPUT are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can sorce (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LED's but useless for connecting to sensors. Pins configured as outputs can also be damaged or destroyed if short circuited to either ground or 5 volt power rails.

June 10, 2007, at 03:32 AM by Paul Badger -
Changed lines 5-6 from:

Defining Logical levels (Boolean Constants)

to:

Defining Logical Levels (Boolean Constants)

There are two boolean constants defined in the C language, upon which Arduino is based: TRUE and FALSE.

FALSE is the easier of the two to define. FALSE is defined as 0 (zero).

TRUE is often said to be defined as 1, which is true, but TRUE has a wider definition. Any integer which is non-zero is TRUE, in a Boolean sense. So -1, 2 and -200 are all defined as TRUE, too, in a Boolean sense.

Defining Pin Levels

Changed lines 16-17 from:

HIGH is representing the programming equivalent to 5 Volts. When reading the value at a digital pin if we get 3 Volts or more the microprocessor will understad it as HIGH. This constant is also represented the integer number 1, and also the truth level TRUE.

to:

HIGH represents the programming equivalent to 5 volts. When reading the value at a digital pin if there is 3 volts or more at the input pin, the microprocessor will understand it as HIGH. This constant is also represented by the integer number 1, and also the truth level TRUE.

Changed lines 26-27 from:

Arduino (Atmega) pins configured as inputs are said to be in a high-impedance state. One way of explaining this is that pins configured as INPUT make extremely small demands on the circuit that they are sampling, say equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor, but not powering an LED.

to:

Arduino (Atmega) pins configured as INPUT are said to be in a high-impedance state. One way of explaining this is that pins configured as INPUT make extremely small demands on the circuit that they are sampling, say equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor, but not powering an LED.

Changed lines 30-33 from:

Pins configured as OUTPUT are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can sorce (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LED's but useless for connecting to sensors.

to:

Pins configured as OUTPUT are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can sorce (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LED's but useless for connecting to sensors. Pins configured as outputs can also be damaged or destroyed if short circuited to either ground or 5 volt power rails. For this reason it is a good idea to connect output pins with 470Ω or 1k resistors.

May 28, 2007, at 08:24 PM by Paul Badger -
Changed lines 31-41 from:
to:
May 28, 2007, at 08:23 PM by Paul Badger -
Changed lines 15-16 from:

Digital pins can be used either as INPUT or OUTPUT. These values drastically change the electrical behavior of the pins.

to:

Digital pins can be used either as INPUT or OUTPUT. Changing a pin from INPUT TO OUTPUT with pinMode() drastically changes the electrical behavior of the pin.

Changed lines 19-20 from:

Arduino (Atmega) pins configured as inputs are said to be in a high-impedance state. One way of explaining this is that input pins make extremely small demands on the circuit that they are sampling, say equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor, but not powering an LED.

to:

Arduino (Atmega) pins configured as inputs are said to be in a high-impedance state. One way of explaining this is that pins configured as INPUT make extremely small demands on the circuit that they are sampling, say equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor, but not powering an LED.

Changed lines 23-26 from:

Pins configured as outputs are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can sorce (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LED's but useless for connecting to sensors.

to:

Pins configured as OUTPUT are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can sorce (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LED's but useless for connecting to sensors.

May 28, 2007, at 08:20 PM by Paul Badger -
Changed lines 3-6 from:

Constants are predefined variables in the system. They are used to make the programs easier to read. We classify constants in groups.

Defining Logical levels

to:

Constants are predefined variables in the Arduino language. They are used to make the programs easier to read. We classify constants in groups.

Defining Logical levels (Boolean Constants)

Changed lines 9-12 from:

HIGH is representing the programming equivalent to 5 Volts. When reading the value at a digital pin if we get 3 Volts or more the microprocessor will understad it as HIGH. This constant represents the integer number 1, and also the truth level TRUE.

LOW is representing the programming equivalen to 0 Volts. When reading the value at a digital pin if we get 2 Volts or less the microprocessor will understand it as LOW. This constant represents the integer number 0, and also the truth level FALSE.

to:

HIGH is representing the programming equivalent to 5 Volts. When reading the value at a digital pin if we get 3 Volts or more the microprocessor will understad it as HIGH. This constant is also represented the integer number 1, and also the truth level TRUE.

LOW is representing the programming equivalent to 0 volts. When reading the value at a digital pin, if we get 2 volts or less, the microprocessor will understand it as LOW. This constant if also represented by the integer number 0, and also the truth level FALSE.

Changed lines 15-16 from:

Digital pins can be used either as INPUT or OUTPUT. These values represent precisely what their meaning stands for.

to:

Digital pins can be used either as INPUT or OUTPUT. These values drastically change the electrical behavior of the pins.

Pins Configured as Inputs

Arduino (Atmega) pins configured as inputs are said to be in a high-impedance state. One way of explaining this is that input pins make extremely small demands on the circuit that they are sampling, say equivalent to a series resistor of 100 Megohms in front of the pin. This makes them useful for reading a sensor, but not powering an LED.

Pins Configured as Outputs

Pins configured as outputs are said to be in a low-impedance state. This means that they can provide a substantial amount of current to other circuits. Atmega pins can sorce (provide positive current) or sink (provide negative current) up to 40 mA (milliamps) of current to other devices/circuits. This makes them useful for powering LED's but useless for connecting to sensors.

See also

May 27, 2007, at 02:43 AM by Paul Badger -
Changed lines 1-2 from:

Constants

to:

constants

April 16, 2007, at 04:33 PM by Paul Badger -
Deleted lines 16-17:
March 25, 2006, at 12:40 AM by Jeff Gray -
Changed lines 1-2 from:

Constants

to:

Constants

January 13, 2006, at 12:48 AM by 82.186.237.10 -
Changed lines 15-18 from:

Digital pins can be used either as INPUT or OUTPUT. These values represent precisely what their meaning stands for.

to:

Digital pins can be used either as INPUT or OUTPUT. These values represent precisely what their meaning stands for.

Reference Home

December 03, 2005, at 08:10 PM by 213.140.6.103 -
Added lines 1-15:

Constants

Constants are predefined variables in the system. They are used to make the programs easier to read. We classify constants in groups.

Defining Logical levels

When reading or writing to a digital pin there are only two possible values a pin can take/be-set-to: HIGH and LOW.

HIGH is representing the programming equivalent to 5 Volts. When reading the value at a digital pin if we get 3 Volts or more the microprocessor will understad it as HIGH. This constant represents the integer number 1, and also the truth level TRUE.

LOW is representing the programming equivalen to 0 Volts. When reading the value at a digital pin if we get 2 Volts or less the microprocessor will understand it as LOW. This constant represents the integer number 0, and also the truth level FALSE.

Defining Digital Pins

Digital pins can be used either as INPUT or OUTPUT. These values represent precisely what their meaning stands for.

Share