Nobuki HIRAMINE
/
irreceiver
IR Receiver
Revision 0:883a77e07ad5, committed 2012-12-01
- Comitter:
- nobuki
- Date:
- Sat Dec 01 13:23:21 2012 +0000
- Commit message:
- Version 1
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 883a77e07ad5 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Dec 01 13:23:21 2012 +0000 @@ -0,0 +1,26 @@ +#include "mbed.h" + +DigitalIn g_dpinIrReceiver(p30); + +Serial g_serial(USBTX, USBRX); + +int main() +{ + g_serial.baud(115200); + + Timer timer; + timer.start(); + int iMicroSec_prev = timer.read_us(); + int iState_prev = 1; + while(1) + { + int iState = g_dpinIrReceiver; + if( iState != iState_prev ) + { + iState_prev = iState; + int iMicroSec = timer.read_us(); + g_serial.printf( "%d, ", iMicroSec - iMicroSec_prev ); + iMicroSec_prev = iMicroSec; + } + } +}
diff -r 000000000000 -r 883a77e07ad5 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Dec 01 13:23:21 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/890817bdcffb \ No newline at end of file