Line Tracking Sensor (SEN0017)

Dependencies:   mbed

Revision:
0:d0644764c90b
--- /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... 
+       } 
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+