Buttons not responding using pullup resistors
i using ethernet pro (based on arduino uno) , using 5-way tactile switch (joystick) (http://www.sparkfun.com/products/11160)
i followed schematic (http://dlnmh9ip6v2uc.cloudfront.net/datasheets/breakoutboards/5-way_tactile_switch_bob_v10.pdf) connected "vcc" (pin1 on joystick) 5v source , resistors 5v power source well. way, connected "pin1, vcc" , ends of resistors in parallel 5v source. , had common ground.
problem is, there's no response... idea how can troubleshoot? also, here's code using...
i followed schematic (http://dlnmh9ip6v2uc.cloudfront.net/datasheets/breakoutboards/5-way_tactile_switch_bob_v10.pdf) connected "vcc" (pin1 on joystick) 5v source , resistors 5v power source well. way, connected "pin1, vcc" , ends of resistors in parallel 5v source. , had common ground.
problem is, there's no response... idea how can troubleshoot? also, here's code using...
code: [select]
#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);
}
}
problem is, there's no response... idea how can troubleshoot?
yes...
1. use neither pin 0 nor pin 1 pushbuttons. use them serial.
2. riddle code serial.println calls can differentiate between pushbutton problems , roboclaw problems.
quote
[font=courier new]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);
}
[/font]
Arduino Forum > Using Arduino > Programming Questions > Buttons not responding using pullup resistors
arduino
Comments
Post a Comment