Go Down

Topic: Digital Inputs problem (Read 235 times) previous topic - next topic

eduferbur

Hi, I'm new at arduino programming.
I starting a big project, but from the begging I detected some weird board functioning.

I try to turn HIGH the digital output 4 when a Digital Input is high, else output 4 LOW.

With INPUT 3 it works, but using the rest of INPUTS it has a "turn off delay", I mean, when I turn LOW IN2, OUT4 wait about 1 second to turn LOW. Even some times, with no tensión cable, I touch IN2, and OUT4 turn HIGH for a second.

The board is new. Arduino YUN rev2. I use a parallel 10Kohm ressitor for inputs and I use the 5v from the board. For the outputs I use a 220ohm for the diode.

I want to know if I'm doing sth wrong or the board has some problem :(
Thanks in advance.

Code with IN2 and IN3:

int Pulsador2 = 2;
int Pulsador3 = 3;
int LED = 4;

void setup() {
pinMode (Pulsador2, INPUT);
pinMode (Pulsador3, INPUT);
pinMode (LED, OUTPUT);

}
void loop() {
if (digitalRead(Pulsador2) == HIGH || digitalRead(Pulsador3) == HIGH ){
  digitalWrite(LED, HIGH);
  }

else {
  digitalWrite(LED, LOW);
  }

}

Go Up