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