YIC day 2

Dependencies:   RemoteIR mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "TransmitterIR.h"
00003 
00004 DigitalOut lpc1768_led_1(LED1);
00005 DigitalOut grove_button(p20);
00006 
00007 TransmitterIR ir_tx(p21);
00008 
00009 int main() {
00010     lpc1768_led_1 = 0;
00011     while(1) {
00012         if (grove_button) {
00013             lpc1768_led_1 = 1;
00014             
00015             RemoteIR::Format format = RemoteIR::SONY;
00016             uint8_t buf[] = { 0x80, 0x00 };
00017             int bitcount = 12;
00018             if (ir_tx.getState() == TransmitterIR::Idle) {
00019                 bitcount = ir_tx.setData(format, buf, bitcount);
00020             }               
00021         }
00022         lpc1768_led_1 = 0;
00023     }
00024 }