![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
part of the pill dispenser project. Used to detect motion of pill passing through the channel. calls an interrupt when pill is detected.
Fork of Seeed_Grove_PIR_Motion_Sensor_Example by
main.cpp
- Committer:
- sam_grove
- Date:
- 2014-08-15
- Revision:
- 0:cc930b964211
- Child:
- 1:b962fe76b826
File content as of revision 0:cc930b964211:
#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); } } }