Buttons not responding using pullup resistors

I am using the Ethernet Pro (based on Arduino Uno) and am using this 5-Way Tactile Switch (Joystick) (http://www.sparkfun.com/products/11160)

I followed the schematic (http://dlnmh9ip6v2uc.cloudfront.net/datasheets/BreakoutBoards/5-Way_Tactile_Switch_BOB_v10.pdf) Where I connected the “VCC” (pin1 on the joystick) to a 5V source and the resistors to the 5V power source as well. By the way, I connected the “pin1, VCC” and the ends of the resistors in parallel to the 5V source. And I had a common ground.

Problem is, there’s no response… any idea how I can troubleshoot? Also, here’s the code I am using…

#include <BMSerial.h>
#include <RoboClaw.h>

#define address 0x80



// Joypad Buttons
const int upA = 0;
const int downA = 1;
const int upB = 2;
const int downB = 3;

// RoboClaw stuff
RoboClaw roboclaw(12,13);
int mSpeed = 64;

void setup()
{
  pinMode(upA, INPUT);
  pinMode(downA, INPUT);
  pinMode(upB, INPUT);
  pinMode(downB, INPUT);

  digitalWrite(0, HIGH);
  digitalWrite(1, HIGH);
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  
  Serial.begin(2400);
}

void loop()
{
     if(digitalRead(upA) == HIGH)
  {    
    roboclaw.ForwardM1(address, mSpeed);
  }

    if(digitalRead(downA) == LOW)
  {    
    roboclaw.BackwardM1(address, mSpeed);  
  }
  
    if(digitalRead(upB) == LOW)
  {    
    roboclaw.ForwardM2(address, mSpeed);  
  }
  
    if(digitalRead(downB) == LOW)
  {    
    roboclaw.BackwardM2(address, mSpeed);  
  }
    
}

teamhydraucd:
Problem is, there’s no response… any idea how I can troubleshoot?

Yes…

  1. Use neither pin 0 nor pin 1 for pushbuttons. Use them for Serial.

  2. Riddle your code with Serial.println calls so you can differentiate between pushbutton problems and roboclaw problems.

void loop()
{
if(digitalRead(upA) == HIGH)
{
Serial.println( F( “UP” ) );
roboclaw.ForwardM1(address, mSpeed);
}

if(digitalRead(downA) == LOW)
{
Serial.println( F( “DOWN” ) );
roboclaw.BackwardM1(address, mSpeed);
}

There is little point in using external pull up resistors as you enable the internal ones. Use a meter to see that you are getting a ground on the pins when you switch the joystick.

Will try this out and see how this works out…

Grumpy_Mike:
There is little point in using external pull up resistors as you enable the internal ones.
Use a meter to see that you are getting a ground on the pins when you switch the joystick.

I’m a little confused. The schematic shows 10kohm resistors. I never attached any external resistors since I assumed the “built in” pullup resistors were already there and were the 10kohm one’s shown.

Interesingly enough, it could explain why no matter which button I switched, I got a 0V reading but I didn’t read 4-5V (from power source) when a specific button went unpressed.

This:-

Where I connected the "VCC" (pin1 on the joystick) to a 5V source and the resistors to the 5V power source as well.

Sort of says you did attach external resistors. Anyway you should measure continuity to ground when you operate a switch and not otherwise. Test this before wiring it up to the arduino. Then with the arduino powerd you should see 5V or so on the input pins. Don't use pins 0 & 1. And you should see it go to zero when you operate the joystick. If you don't see this then your wiring is wrong.