Pages: [1]   Go Down
Author Topic: DUE pins always reading HIGH  (Read 540 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey everyone,

I just purchased the DUE for a project and I've been having nothing but issues.

First off, if I do an analog read on any of the A pins without anything connected, it gives me serial values that fluctuate anywhere between 22 and 300. I'm not sure if this is a noise issue or what...

Secondly, using this code without anything connected, it will always give me a HIGH value with serial read.
 
Code:
void setup() {
  pinMode (22, INPUT);      //just a random pin, tried a handful already, same results
  Serial.begin(9600);

}

void loop() {

    Serial.println(digitalRead(22));
    delay(500);
 
}

I've been searching for 2 days now to find an answer to this. Is there a problem with the board itself, or am I missing something?

Thanks!
Logged

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

Quote
Secondly, using this code without anything connected, it will always give me a HIGH
If you've got nothing connected, what did you expect to read?
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.

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

Quote
If you've got nothing connected, what did you expect to read?

Forgive me, I'm still new at this. I expected it to read 0, but I assume that a pull down connected would solve it. smiley-red

Will pull-downs also solve the weird analog readings?

Logged

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11672
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Why read a pin that's not connected to anything and then worry about it?

INPUT pins float (unless internal pullups are engaged), that's because they are
effectively open-circuit and respond to any nearby fields.

This is nothing Due or even Arduino specific, all CMOS inputs are like this, inputs
connect only to MOSFET gates and MOSFET gates are insulated by silicon dioxide
which is a phenomenally good insulator.
Logged

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

Pages: [1]   Go Up
Jump to: