I am new to electronics and microcontrollers. I am using an LPC1768 and a hc sr501 PIR sensor to create a simple motion detector. I have connected the pins of the PIR sensor to the breadboard and the lpc1768. I have imported the code from the mbed library however on moving my hand across the sensor the led does not light up.
#include "mbed.h"
DigitalOut led1(LED1);
DigitalIn alarm(p29, PullUp); //internal pull up
int main() {
wait(2);
while(1) {
if (!alarm){
led1=1;
wait(2);
}
else
led1=0;
}
}