mbed school
/
mbed_IR_HellowWorld
紅外線接收端
Revision 0:aefe311b9eda, committed 2015-02-14
- Comitter:
- mbedschool
- Date:
- Sat Feb 14 05:08:32 2015 +0000
- Commit message:
- ir
Changed in this revision
diff -r 000000000000 -r aefe311b9eda RemoteIR.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RemoteIR.lib Sat Feb 14 05:08:32 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/shintamainjp/code/RemoteIR/#268cc2ab63bd
diff -r 000000000000 -r aefe311b9eda main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Feb 14 05:08:32 2015 +0000 @@ -0,0 +1,18 @@ +#include "mbed.h" +#include "ReceiverIR.h" +ReceiverIR ir_rx(p15); + +DigitalOut myled(LED1); +RemoteIR::Format format; +uint8_t buf[32]; +int bitcount; +int main() { + while(1) + { + if (ir_rx.getState() == ReceiverIR::Received) { + bitcount = ir_rx.getData(&format, buf, sizeof(buf) * 8); + if ( buf[0]== 0x80 && buf[1] == 0x00 ) + myled=1; + } + } +}
diff -r 000000000000 -r aefe311b9eda mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Feb 14 05:08:32 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa \ No newline at end of file