uk
Offline
Sr. Member
Karma: 0
Posts: 310
|
 |
« on: April 19, 2012, 02:04:02 pm » |
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
Newbie
Karma: 0
Posts: 29
|
 |
« Reply #1 on: April 19, 2012, 02:38:38 pm » |
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. void setup(){ Serial.begin(9600); pinMode(supfanled, INPUT); // supply fan led o/p digitalWrite(supfanled, HIGH); // turn on pullup resistors }
|
|
|
|
|
Logged
|
|
|
|
|
uk
Offline
Sr. Member
Karma: 0
Posts: 310
|
 |
« Reply #2 on: April 19, 2012, 02:43:44 pm » |
thank you, ive got it amazing, internal r's
|
|
|
|
« Last Edit: April 19, 2012, 02:48:46 pm by jonisonvespa »
|
Logged
|
|
|
|
|
Global Moderator
Dallas
Online
Shannon Member
Karma: 118
Posts: 10165
|
 |
« Reply #3 on: April 19, 2012, 03:12:17 pm » |
@jonisonvespa: Are you using Ardunio IDE 1.0?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 0
Posts: 275
|
 |
« Reply #4 on: April 19, 2012, 08:59:24 pm » |
Try using: pinMode(n, INPUT_PULLUP); where n is your pin number.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #5 on: April 20, 2012, 03:14:17 am » |
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.
|
|
|
|
Global Moderator
Dallas
Online
Shannon Member
Karma: 118
Posts: 10165
|
 |
« Reply #6 on: April 20, 2012, 03:41:18 am » |
Release candidate 2 (-rc2). I think release candidate 1 has it as well.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 219
Posts: 13896
Lua rocks!
|
 |
« Reply #7 on: April 20, 2012, 03:59:09 am » |
What's INPUT_PULLUP when it's at home? Wouldn't PULLUP be better?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Tesla Member
Karma: 71
Posts: 6622
Arduino rocks
|
 |
« Reply #8 on: April 20, 2012, 05:05:18 am » |
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
|
|
|
|
|
uk
Offline
Sr. Member
Karma: 0
Posts: 310
|
 |
« Reply #9 on: April 20, 2012, 07:24:16 am » |
pinMode(fan1, INPUT_PULLUP);
tyred that but got, was not declared at this scope, im using arduino 1.0
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #10 on: April 20, 2012, 07:31:34 am » |
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.
|
|
|
|
uk
Offline
Sr. Member
Karma: 0
Posts: 310
|
 |
« Reply #11 on: April 20, 2012, 07:46:55 am » |
ok thank you awal
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 0
Posts: 275
|
 |
« Reply #12 on: April 23, 2012, 03:34:12 pm » |
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
|
|
|
|
|
|