This program is example of using PAW_Sensor Library.

Dependencies:   PAW_Sensor mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "paw.h"
00003 
00004 Serial pc( USBTX, USBRX ); 
00005 const unsigned long baudrate = 115200;
00006 
00007 // paw( LED1, LED2, PHOTO1, PHOTO2 )
00008 PAW paw( p8, p9, p16, p17 );
00009 paw_value g_value;
00010 
00011 Ticker run;
00012 
00013 
00014 void run_paw_sensor()
00015 {
00016     if( paw.process_paw() == STATE_1 )
00017     {
00018         paw.print( &pc, 0 );   
00019     }
00020 }
00021 
00022 int main() 
00023 {
00024     // Initializing Serial Communication
00025     pc.baud( baudrate );
00026     pc.format( 8, Serial::None, 1 );
00027     
00028     run.attach_us(&run_paw_sensor, 500);
00029     
00030     while(1);
00031 }