奈何col 发表于 2013-8-23 12:19
这个不清楚了
[mw_shl_code=c,true]#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
IRsend irsend;
unsigned int buf[85]=
{3650,1800,600,1050,650,1050,600,1050,650,1000,650,500,600,500,650,1050,600,500,650,1000,650,1000,700,500,550,550,600,500,650,450,600,1100,600,500,650,500,600,1050,650,1050,600,1050,650,500,550,550,600,1050,650,500,3650,1800,550,1100,600,1050,600,1100,600,1100,550,550,600,500,650,500,550,550,600,500,650,450,600,550,600,500,650,1050,600,1050,650,1050,600,1050,650};
void setup()
{
pinMode(13,OUTPUT);
Serial.begin(9600);
irrecv.enableIRIn();
}
void dump(decode_results *results) {
int count = results->rawlen;
Serial.print("Raw (");
Serial.print(count, DEC);
Serial.print("): ");
for (int i = 0; i < count; i++) {
if ((i % 2) == 1) {
Serial.print(results->rawbuf*USECPERTICK, DEC);
}
else {
Serial.print(-(int)results->rawbuf*USECPERTICK, DEC);
}
Serial.print(" ");
}
Serial.println("");
}
void loop() {
digitalWrite(13,HIGH);
delay(1000);
irsend.sendRaw(buf,85,38);
delay(3000);
digitalWrite(13,LOW);
delay(1000);
if (irrecv.decode(&results)) {
dump(&results);
irrecv.resume();
}
}[/mw_shl_code] |