red/power 5v/39 white/gnd/1 signal/black/19 use MBED stand alone ONLY ok seems to take the LED a long time to turn off - why? http://bildr.org/2011/06/pir_arduino/
Revision 0:c3ab9adf1295, committed 2014-02-19
- Comitter:
- avnisha
- Date:
- Wed Feb 19 04:54:12 2014 +0000
- Commit message:
- ok
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Feb 19 04:54:12 2014 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" + +/* + * Test the motion sensor + */ + + +DigitalOut LED(LED1); +DigitalIn PIR(p19); + + +int main() { + + PIR.mode(PullUp); + LED = 0; + + while(1) { + //printf("PIR %d \r\n", (int)PIR); + if (!PIR){ + LED=1; + wait(1.0); + }else{ + LED=0; + } + + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Feb 19 04:54:12 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file