Can't make push button to work, no matter what I do or board I use


i'm doign stupid, can't make simplest thing of all, push button work.

have tried same config original arduino uno , sainsmart uno.

the diagram basic can see pictures attached.

the code i'm using have nothing unusual:

code: [select]

/* basic digital read
* ------------------
*
* turns on , off light emitting diode(led) connected digital 
* pin 13, when pressing pushbutton attached pin 2. illustrates the
* concept of active-low, consists in connecting buttons using a
* 1k 10k pull-up resistor.
*
* created 1 december 2005
* copyleft 2005 dojodave <http://www.0j0.org>
* http://arduino.berlios.de
*
*/

int ledpin = 13; // choose pin led
int inpin = 2;   // choose input pin (for pushbutton)
int val = 0;     // variable reading pin status

void setup() {
  pinmode(ledpin, output);  // declare led output
  pinmode(inpin, input);    // declare pushbutton input
}

void loop(){
  val = digitalread(inpin);  // read input value
  if (val == high) {         // check if input high (button released)
    digitalwrite(ledpin, low);  // turn led off
  } else {
    digitalwrite(ledpin, high);  // turn led on
  }
}


any ideas??? i'm out!

get out meter , measure voltage on pin 2. test button pushed , not.
if there no change trace connection meter on resistance (and power off)


Arduino Forum > Using Arduino > Sensors > Can't make push button to work, no matter what I do or board I use


arduino

Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support