I would like to know.

I have Pin 6, 7, 8 and 9 as INPUT_PULLUP. I have switch to each other pin. Why when I press switch at PIN 6. SOMETIMES PIN 7 also getting input. Other case, also when I press switch at 7, other pin also trigger. Why?

This case is random. Sometimes everything is ok when I press 10 times, but after that other pin also trigger. Another case only 4-5 times press, then other pin also trigger.

I use switch on/off not temporary switch.

How to fix this? Is it common problem with arduino?


Program. (Simple Program)

int led1 = 1;
int led2 = 2;
int led3 = 3;
int led4 = 5;

int switch1 = 6;
int switch2 = 7;
int switch3 = 8;
int switch4 = 9;

int led = 13;

//int counter = 0;

void setup()
  // put your setup code here, to run once
      pinMode(led1, OUTPUT);
      pinMode(led2, OUTPUT);
      pinMode(led3, OUTPUT);
      pinMode(led4, OUTPUT);
      pinMode(switch1, INPUT_PULLUP);
      pinMode(switch2, INPUT_PULLUP);
      pinMode(switch3, INPUT_PULLUP);
      pinMode(switch4, INPUT_PULLUP);
      pinMode(led, OUTPUT);
void loop()

if (digitalRead(switch1) == 0){
  digitalWrite(led1, HIGH);

 if (digitalRead(switch1) == 1){
  digitalWrite(led1, LOW);

if (digitalRead(switch2) == 0){
  digitalWrite(led2, HIGH);

 if (digitalRead(switch2) == 1){
  digitalWrite(led2, LOW);

if (digitalRead(switch3) == 0){
  digitalWrite(led3, HIGH);

 if (digitalRead(switch3) == 1){
  digitalWrite(led3, LOW);

if (digitalRead(switch4) == 0){
  digitalWrite(led4, HIGH);

 if (digitalRead(switch4) == 1){
  digitalWrite(led4, LOW);

digitalWrite(led, HIGH);


digitalWrite(led, LOW);



My Circuit is simple as like that for the input. For the output only to led, resistor and ground.

I found similar case http://www.instructables.com/id/Arduino-Push-Switch-Debouncing-Interrupts/

On the website, He said, "The problem with this setup was when the button was pressed the interrupt was being called multiple times and even toggling other buttons. Why was this happening? It is caused from a switch bouncing feedback."

Is there any solution without modifying the hardware?


The problem is the wire.

My wire for switch is jumper cable, and each other closer (touch) to each other cable. I try to separate, and works. There is no other pin will be trigger.

  • Can you post a schematic or a simple diagram of your circuit?
    – Nateowami
    Mar 14, 2016 at 8:06
  • Is what a common problem? With no schematic, and no code, your question doesn't make any real sense. Please read How do I ask a good question?
    – Nick Gammon
    Mar 14, 2016 at 8:09
  • @Nateowami, I have been updated my question with code and schematic. Do you have any experience with this? Because I think it should be something wrong with the Arduino.
    – ucon89
    Mar 14, 2016 at 9:28
  • @NickGammon I have been updated my question with code and schematic. Do you have any experience with this? Because I think it should be something wrong with the Arduino.
    – ucon89
    Mar 14, 2016 at 9:28
  • 1
    I mean delay is always a bad idea regardless of what you are doing - especially when you are reading switches and expecting them to respond in a normal fashion.
    – Majenko
    Mar 14, 2016 at 12:26

1 Answer 1


You may be getting switching noise between the button wires, which is low-level and brief, but with no debouncing, it could be just enough to cause the effect you're seeing.

I'd suggest 1) writing a short function that debounces and reads any button; and 2) using if/else statements instead of testing each button twice.

A quick test is to hold one pair of wires closer together or farther apart from each other while you press one of those two buttons, and see whether the distance apart changes the effect. If it does, you've found the cause.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.