Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of frdm_Grove_PIR_Example by
main.cpp
00001 00002 #include "mbed.h" 00003 00004 InterruptIn motion(D2); 00005 00006 int motion_detected = 0; 00007 00008 void irq_handler(void) 00009 { 00010 motion_detected = 1; 00011 } 00012 00013 int main(void) 00014 { 00015 int cnt = 0; 00016 motion.rise(&irq_handler); 00017 00018 while(1) { 00019 if(motion_detected) { 00020 cnt++; 00021 motion_detected = 0; 00022 printf("Hello! I've detected %d times since reset\n", cnt); 00023 } 00024 } 00025 }
Generated on Mon Aug 1 2022 19:34:11 by
1.7.2
