I am trying to read some resistive buttons presses on a PCB like this:

game gear buttons PCB

This is the full sketch I am using:

#include <Keyboard.h>

byte ZbuttonPin = 3; 

void setup() {
 // initialize the button-reading pins
  pinMode(ZbuttonPin, INPUT_PULLUP);

void loop() {
  if (digitalRead(ZbuttonPin) == 0) {
    // if the button goes low
    Keyboard.write('z'); // send a 'z' to the computer via Keyboard HID
    delay(100); // delay so there aren't a kajillion z's

If I short the Arduino pin 3 and GND directly it outputs the "z" letter correctly.

But when I connect M16 and GND on the PCB it outputs "z" continuously even if the button if not pressed with the rubber pad.

  • I would suppose that showing the circuit would help others help you. Shorting this or shorting may mean a lot to you hurt exactly zero to those who may be of help to you. Help others help you. – dannyf Jun 25 '17 at 13:50
  • Use a multimeter to test the resistance when the button is pressed and when it is not pressed. Perhaps adjusting the voltage level with a pullup resistor is enough to make it work. – Jot Jun 25 '17 at 13:51
  • the resistance is about 1.5M ohms when not pressed and 170ohms when pressed... should i change the read logic? – eadmaster Jun 26 '17 at 9:17
  • Those values seem okay. It should work. Perhaps you can try with an extra pullup resistor of about 1k to 10k from pin 3 to 5V. – Jot Jun 26 '17 at 14:40
  • i've tried adding a 10K resistor in series with the pin 3, but still not working as expected. do you think using the 5v pin and wiring like this may solve the problem? – eadmaster Jun 27 '17 at 18:22

Your Answer

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

Browse other questions tagged or ask your own question.