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

I bought my Arduino 2 days ago .
I connected my Arduino TMP36 but it isn't stable and when I removed it analog reads something bigger than zero.

Now , I'm trying my change with digitalRead but this isn't work neither.

Code:

int ledPin = 13;


void setup()
{
  Serial.begin(9600);
  pinMode(ledPin,OUTPUT);
  pinMode(8,OUTPUT);
  pinMode(10,INPUT);
}

void loop()
{
  digitalWrite(10,LOW);
  digitalWrite(8,HIGH);
  if(digitalRead(10) == HIGH)
  {
    Serial.println("hey!");
  }
}

When ever something touch (even nothing connected cable) 10th pin it writes "hey!" I just confused.

Sorry about my english.


--

Things going even stranger when something approach 8-9-10 th pins its alert  smiley-eek
« Last Edit: March 23, 2012, 04:25:55 pm by emiravci27 » Logged

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

Without a pull up, the pin is floating.
You turn off the pull up every time through loop().
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.

Pages: [1]   Go Up
Jump to: