This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

getting input from pushbutton(lpc1768)

hi, im using lpc1768 development board
i have written a code for push button
when button pressed led should turn on
but the led is not responding to button, it is on always
even i checked in keil peripherals(ports)it is going inside the if condition without the pin high
here is my code

#include "lpc17xx.h"
void delay(uint32_t c)
{ while(c>0)
c--;
} int main(void)
{ SystemInit();
LPC_GPIO0->FIODIR |=(1<<4);
LPC_GPIO2->FIODIR &= ~(1<<10);
while(1)
{ if(((LPC_GPIO2->FIOPIN >> 10) & 1) == 1)
{ LPC_GPIO0->FIOSET=0x00000010;
delay(10000);
} else
{ LPC_GPIO0->FIOCLR=0x00000010;
delay(10000);
} }
}

my project is on hold because of this
please help me out

thank you