Line Tracking Sensor (SEN0017)
Dependencies: mbed
Revision 0:d0644764c90b, committed 2016-11-06
- Comitter:
- Mattinico
- Date:
- Sun Nov 06 19:15:26 2016 +0000
- Commit message:
- k
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 |
diff -r 000000000000 -r d0644764c90b main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Nov 06 19:15:26 2016 +0000 @@ -0,0 +1,71 @@ +#include "mbed.h" +InterruptIn LT(D2); //define and name the interrupt input +DigitalOut led(LED1); +Serial pc(USBTX, USBRX); + +void ISR1() //this is the response to interrupt, i.e. the ISR +{ + pc.printf("Warning: reflective surface detected!\n\r"); + led=1; + wait(0.5); + led=0; + } + + int main() + { + led=0; + LT.rise(&ISR1); // attach the address of the ISR function to the + // interrupt rising edge + while(1) { // continuous loop, ready to be interrupted + // code here... + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff -r 000000000000 -r d0644764c90b mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Nov 06 19:15:26 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9bcdf88f62b0 \ No newline at end of file