Grove - Dual Button - 2nd button won´t work

Hi,

I purchased a " Grove - Dual Button" but cant get the 2nd button working.

Here is my hardware setup:

  1. Arduino MKR GSM 1400
  2. Arduino MKR Connector Carrier (Grove compatible)
  3. Grove - White LED
  4. Grove - Dual Button

I conntected the external “Grove - White LED” to D3 and " Grove - Dual Button" to D1. The build-in LED of the Arduino MKR GSM 1400 is on D6.

I want to control with each button of the module one LED, but currently only the button labeled “1” turns on an LED. I tested the assignment of the LEDs with other sketches and they work.
Please advise.

Here is my sketch:


int button1 = 1; //set the button1 pin

 int button2 = 2; //set the button2 pin

 int LED = 6;  //set the LED pin

 int LEDex = 3;  //set the LED pin

 bool state1 = 1; //set button1 state

 bool state2 = 1; //set button2 state

 void setup()

 {

   pinMode(button1,INPUT);
   pinMode(button2,INPUT);

   pinMode(LED,OUTPUT);
   pinMode(LEDex,OUTPUT);

 }
 

 void loop()

 {

  state1 = digitalRead(button1);

  state2 = digitalRead(button2);

  if (state1 == 0)

  {

    digitalWrite(LEDex,HIGH);

    }

  else

  {

    digitalWrite(LEDex,LOW);

    } 

if (state2 == 0)

  {

    digitalWrite(LED,HIGH);

    }

  else

  {

    digitalWrite(LED,LOW);

    } 
 

 }

Swap the order of the second button to control the light to see if it can turn on the light? If it doesn’t work, maybe the button is faulty. At this time, you can contact our technical support mailbox to feedback the replacement process.

The connector carrier was the problem: Once I connected the button module to D5/D6 it works.