Framework (A-Z)

Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.

Name

pullup()

Examples
int inpin = 8;
int val = 0;

void setup() {
  pinMode(WLED, OUTPUT);
  pinMode(inpin, INPUT); 
  // sets the internal pullup on the pin
  pullup(inpin);
}

void loop() {
  // since the pin has the internal
  // pullup resistor enabled 
  // reading the pin with nothing attach to it will
  // return HIGH
  val = digitalRead(inpin);
  if (val == HIGH) 
  {
    digitalWrite(WLED, HIGH);
  } else {
    digitalWrite(WLED, LOW);
  } 
}
Description Pullup resistors are used in circuits to ensure that an input pin settle at an expected logical value (HIGH) when the pin is disconnected or high-impedance. The pullup() method sets the AVR core processors internal pullup resistor on a pin. By default the internal pullup is disabled.
Syntax
pullup(pin)
Parameters
pin pin number
Returns None
Usage Application
Related noPullup()
INPUT
OUTPUT
pinMode()
digitalWrite()
digitalRead()
Updated on July 07, 2011 11:08:48pm PDT

Creative Commons License