Line Tracking Sensor (SEN0017)

Dependencies:   mbed

main.cpp

Committer:
Mattinico
Date:
2016-11-06
Revision:
0:d0644764c90b

File content as of revision 0:d0644764c90b:

#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... 
       } 
 }