Loading...
Pages: [1]   Go Down
Author Topic: Input pullup  (Read 348 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

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

0
Online Online
Tesla Member
***
Karma: 87
Posts: 8478
:(){:|:&};:
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

define (or sobstitute) INPUT_PULLUP with LOW
Logged

my Arduino code: https://github.com/lestofante/arduinoSketch
sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie

Queens, New York
Offline Offline
Edison Member
*
Karma: 31
Posts: 1726
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wait, don't you want it HIGH? it is PULL UP, not DOWN
« Last Edit: December 21, 2012, 09:26:51 am by HazardsMind » Logged

UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W

"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown

0
Online Online
Tesla Member
***
Karma: 87
Posts: 8478
:(){:|:&};:
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

if you want pullup, then HIGH, if you don't want id, then LOW
Logged

my Arduino code: https://github.com/lestofante/arduinoSketch
sei nuovo? non sai da dove partire? leggi qui: http://playground.arduino.cc/Italiano/Newbie

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 19
Posts: 3117
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Which IDE version are you using?
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 282
Posts: 15435
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 142
Posts: 19338
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
its 1.0. how does that differs?
I'm pretty sure the feature isn't present in 1.0
Logged

Pete, it's a fool looks for logic in the chambers of the human heart.

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 19
Posts: 3117
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Print
 
Jump to: