Go Down

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

samarpanrai

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 :

Quote

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(rtPin,OUTPUT);
    pinMode(ltPin,OUTPUT);
    pinMode(enable,OUTPUT);
   
    pinMode(upperLimit, INPUT_PULLUP); // INTERNAL pullup
    pinMode(lowerLimit, INPUT_PULLUP);
   
   
    Serial.begin(9600);
    Serial.flush();
   
    digitalWrite(outPin, 1); // show initilization is done
    delay(100);
    digitalWrite(outPin, 0);
    delay(100);
    digitalWrite(outPin, 1);
    delay(100);
    digitalWrite(outPin, 0);
    delay(100);
    motorEn(1);
    while(digitalRead(upperLimit) || digitalRead(lowerLimit)){
      motor(50); // brring it down
    }
      motorEn(0);
 
}



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?

lesto

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

HazardsMind

#2
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:
https://github.com/AndrewMascolo?tab=repositories

lesto

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

samarpanrai

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?

samarpanrai

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?

dxw00d

Which IDE version are you using?

retrolefty

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:  

Quote
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?

Lefty

samarpanrai

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.

AWOL

Quote
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.

dxw00d

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