2

I tried to get digital reading on my arduino uno board to check if 5V signal is on or off. When I plugged it in digital pin 9 it got really hot really fast. Also it couldn't give me correct readings on A0 analog input. Later it worked fine on digital pin 8. I know that pin 9 can be used to provide PWM output but i thought that they can also be used as regular digital input pins. How can I use this pin as digital input?

Jolta
  • 2,620
  • 1
  • 29
  • 42
user2880783
  • 145
  • 6
  • 18

3 Answers3

1

On reset, all pins is set as INPUT (ref: http://arduino.cc/en/Tutorial/DigitalPins), no need to explicitly set it to INPUT mode.

If something get abnormally hot, it's indication that something is wrong with your circuit (i.e., you should put a limiting resistor, or you put it on wrong polarity, etc.)

vcc2gnd
  • 137
  • 1
  • 5
0
void setup(){
     pinMode(9, INPUT);
}
ladislas
  • 3,037
  • 19
  • 27
0

When using the input pins you have to use three pins. You have to use a ground pin, an analog pin, and a 5V to 3.3V power source. If you are using a switch, button, potentiometer, etc, this is what you have to state:

int slideSwitch

void setup() {
pinMode(slideSwitch, INPUT);
}

void loop() {
}               // your program

I suggest using buttons and switches from http://www.qtechknow.com/

JUST REMEMBER TO US A GROUND, ANALOG PIN, AND A POWER FROM 3.3V to 5V.