Go Down

Topic: internal pull up r's (Read 1 time) previous topic - next topic

jonisonvespaa

Code: [Select]

void setup(){
  Serial.begin(9600);
  pinMode(supfanled, OUTPUT);           // supply fan led o/p
  digitalWrite(supfanled, HIGH);        // turn on pullup resistors


hi
just stumbled upon internal pull up r's, is this the correct place (setup) to define the internal pull up r's?
thank you

tgm1175

Set your pin mode to input instead of output and then you're on your way.

I know it looks wrong to be writing to a pin set to INPUT mode, but that's just how the arduino works for turning on the resistors.

Code: [Select]

void setup(){
  Serial.begin(9600);
  pinMode(supfanled, INPUT);           // supply fan led o/p
  digitalWrite(supfanled, HIGH);        // turn on pullup resistors
}

jonisonvespaa

#2
Apr 19, 2012, 09:43 pm Last Edit: Apr 19, 2012, 09:48 pm by jonisonvespa Reason: 1
thank you, ive got it amazing, internal r's

Coding Badly


@jonisonvespa: Are you using Ardunio IDE 1.0?

RandallR

Try using:
    pinMode(n, INPUT_PULLUP);
where n is your pin number.

AWOL

Quote
Try using:
    pinMode(n, INPUT_PULLUP);

What version of the IDE is that?
"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.

Coding Badly


Release candidate 2 (-rc2).  I think release candidate 1 has it as well.

Nick Gammon

What's INPUT_PULLUP when it's at home? Wouldn't PULLUP be better?
http://www.gammon.com.au/electronics

MarkT


Try using:
    pinMode(n, INPUT_PULLUP);
where n is your pin number.


Its counter-productive to suggest something that cannot work for the current major release.
[ I won't respond to messages, use the forum please ]

jonisonvespaa


pinMode(fan1, INPUT_PULLUP);


tyred that but got, was not declared at this scope, im using arduino 1.0

AWOL

It isn't released yet, which is why posting it was counter-productive.

Just use the pinMode (x, INPUT)/digitalWrite(x, HIGH) method.
"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.

jonisonvespaa


RandallR

Sorry for the confusion.  I am still rather new to this and I just learned about the INPUT_PULLUP parameter.  I had not used very many previous versions of the IDE so I did not know it was so new.

Did not mean to cause any problems.

BTW: RC2 is working great for me.

Go Up