Go Down

Topic: Input pullup (Read 1 time) previous topic - next topic

I went through most of the question related to internal pull ups but i couldn't find the answer. I want to use pin 0 and 1 (though they are analog input) as just digital input with pulls ups but i keep getting this error :


arduino_sketch.cpp: In function 'void setup()':
arduino_sketch:24: error: 'INPUT_PULLUP' was not declared in this scope

My setup code :

Code: [Select]

void setup()
    pinMode(outPin, OUTPUT); // sets the digital pin as output
    pinMode(upperLimit, INPUT_PULLUP); // INTERNAL pullup
    pinMode(lowerLimit, INPUT_PULLUP);
    digitalWrite(outPin, 1); // show initilization is done
    digitalWrite(outPin, 0);
    digitalWrite(outPin, 1);
    digitalWrite(outPin, 0);
    while(digitalRead(upperLimit) || digitalRead(lowerLimit)){
      motor(50); // brring it down

I am using Duemilanove. and when i write 'INPUT_PULLUP' it doesn't gets highlighted in blue like when its gets when I write 'INPUT' or 'OUTPUT'. What might be the reason?


define (or sobstitute) INPUT_PULLUP with LOW
sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie


Dec 21, 2012, 03:24 pm Last Edit: Dec 21, 2012, 03:26 pm by HazardsMind Reason: 1
Wait, don't you want it HIGH? it is PULL UP, not DOWN
My GitHub:


if you want pullup, then HIGH, if you don't want id, then LOW
sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie

lesto :

But i want to initialize this pin as input  :smiley-eek:

And how does defining a pin 'LOW' means that it is input?

HazardsMind :

yes i want it to be pulled up. But i get errors. Any ideas why?

Does this version of arduino compiler( i guess) has error? and its really confusing. You assign high and low when you want to give OUTPUT to the pin, right?


Which IDE version are you using?


You guys are missing the point and what the OP is asking about. At some arduino IDE version (1.0.1) there was an enhancement added to the pinMode function that allows one to define a input pin and set it's internal pull-up resistor if desired:  

As of Arduino 1.0.1, it is possible to enable the internal pullup resistors with the mode INPUT_PULLUP. Additionally, the INPUT mode explicitly disables the internal pullups.

So what version of the Arduino IDE are you compiling the code under?


its 1.0. how does that differs? I mean...anyways i am going to download the latest version and tell you guys what result i get.


its 1.0. how does that differs?

I'm pretty sure the feature isn't present in 1.0
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.


INPUT_PULLUP was introduced in 1.0.1. Prior that, you set the pinMode() to INPUT, and used digitalWrite() to set it to HIGH to turn the pullups on.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131