Arduino Megaと IR Emitting LED があり、この LED を使用して選択したデータ「Hex Data」を送信したいのですが、 IRRemote ライブラリIRrecv
を試してみて、クラスを正常に使用しましたが、使用しIRsend
ても信号が得られません
IRエミッターピンはPWM 3で、 3.3Vに1回、5Vに1回接続しました。
#include <IRremote.h>
IRsend irsend;
void setup()
{
Serial.begin(9600);
}
void loop() {
if (Serial.read() != -1) {
for (int i = 0; i < 3; i++) {
irsend.sendSony(0xa90, 12); // Sony TV power code
delay(40);
}
}
}
レシーバーの場合:
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}
}
どんな助けでも大歓迎です:) Hiso