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
main.cpp
00001 #include "mbed.h" 00002 InterruptIn LT(D2); //define and name the interrupt input 00003 DigitalOut led(LED1); 00004 Serial pc(USBTX, USBRX); 00005 00006 void ISR1() //this is the response to interrupt, i.e. the ISR 00007 { 00008 pc.printf("Warning: reflective surface detected!\n\r"); 00009 led=1; 00010 wait(0.5); 00011 led=0; 00012 } 00013 00014 int main() 00015 { 00016 led=0; 00017 LT.rise(&ISR1); // attach the address of the ISR function to the 00018 // interrupt rising edge 00019 while(1) { // continuous loop, ready to be interrupted 00020 // code here... 00021 } 00022 } 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071
Generated on Wed Aug 10 2022 01:32:43 by
1.7.2