temperature sensor application as a temperature based fan using the FRDM -K64F board
Fork of frdm_Grove_PIR_Example by
Diff: main.cpp
- Revision:
- 0:d444f103013a
- Child:
- 1:5c2fc62b9c0a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Dec 31 23:29:45 2015 +0000 @@ -0,0 +1,25 @@ + +#include "mbed.h" + +InterruptIn motion(D2); + +int motion_detected = 0; + +void irq_handler(void) +{ + motion_detected = 1; +} + +int main(void) +{ + int cnt = 0; + motion.rise(&irq_handler); + + while(1) { + if(motion_detected) { + cnt++; + motion_detected = 0; + printf("Hello! I've detected %d times since reset\n", cnt); + } + } +}