Pages: [1]   Go Down
Author Topic: internal pull up r's  (Read 1180 times)
0 Members and 1 Guest are viewing this topic.
uk
Offline Offline
Sr. Member
****
Karma: 0
Posts: 310
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
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
Logged

Pennsylvania, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
void setup(){
  Serial.begin(9600);
  pinMode(supfanled, INPUT);           // supply fan led o/p
  digitalWrite(supfanled, HIGH);        // turn on pullup resistors
}
Logged

uk
Offline Offline
Sr. Member
****
Karma: 0
Posts: 310
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thank you, ive got it amazing, internal r's
« Last Edit: April 19, 2012, 02:48:46 pm by jonisonvespa » Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12286
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


@jonisonvespa: Are you using Ardunio IDE 1.0?
Logged

Offline Offline
Sr. Member
****
Karma: 1
Posts: 314
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Quote
Try using:
    pinMode(n, INPUT_PULLUP);
What version of the IDE is that?
Logged

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

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12286
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What's INPUT_PULLUP when it's at home? Wouldn't PULLUP be better?
Logged

0
Offline Offline
Shannon Member
****
Karma: 162
Posts: 10456
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

[ I won't respond to messages, use the forum please ]

uk
Offline Offline
Sr. Member
****
Karma: 0
Posts: 310
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


pinMode(fan1, INPUT_PULLUP);


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

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

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

Just use the pinMode (x, INPUT)/digitalWrite(x, HIGH) method.
Logged

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

uk
Offline Offline
Sr. Member
****
Karma: 0
Posts: 310
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok thank you awal
Logged

Offline Offline
Sr. Member
****
Karma: 1
Posts: 314
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: