Iv'e been trying to get the basic atom pro 28 to respond to do a program where an LED lights up every time The PIR sensor I'm using detects motion. I have the +5v on the sensor connected to the +5v on the micro controller, the two grounds connected, and the out wire connected to a I/O (pin 0) on the basic atom pro. I've tried a bunch of stuff and none of it seemed to work. Here is one of the programs I used:
main
if p4 = 1 then
high p5
endif
low p5
goto main
Is my program wrong? What should I change? Is the wiring incorrect? Should I have the sensor have a separate power source? Can someone please tell me how I should hook the sensor (where I should plug the ground, out and +5v, as well as what pin I should use), and what my program should look like? If someone could take the time and answer these questions, I'd greatly appreciate it.
here's the datasheet for the PIR sensor:
http://www.robotshop.com/content/PDF/pi ... -28027.pdf (the codes provided aren't very fit for my application, and plus the codes are for basic stamp)