test

Dependencies:   RemoteIR mbed

main.cpp

Committer:
szh66
Date:
2017-03-23
Revision:
1:11970e541ecf
Parent:
0:3c59bc5c9388
Child:
2:b78dfa2afe92

File content as of revision 1:11970e541ecf:

/**
* This is simple program to test usart with IR sensors.
*/

#include "mbed.h"
#include "IRSensor.h"
 Serial serial (USBTX, USBRX);
 IRSensor testIR (PC_7, PC_5); //pc7 is the output and pc5 is the input
 DigitalOut testLed(PC_8);
 
 
 int main ()
 {
     serial.printf ("Start Program\n");
     
     
     while (1)
     {
         //serial.putc(serial.getc());
         if(testIR.readIR()){
              testLed = 1; 
          
            serial.printf("value is: %f\r\n", testIR.readIR());
            wait (0.5);
         }
         else{
            testLed = 1; 
            wait (0.2);
            testLed = 0; 
            wait (0.2);
         }     
        
     }
 }