问题描述
我正在尝试从我的 LG 逆变器多分离式控制器和红外接收器获取命令。我希望能够使用 IR 发射器创建一个项目来打开、关闭、升温/降温、摆动等逆变器。我正在使用 IrRemote 库:https://github.com/Arduino-IRremote/Arduino-IRremote 以及 IRreceiveDemo 和 irsend 来接收和发送数据。
我正在努力处理从接收草图接收的数据以及插入数据的位置我收到了。
我目前正在通过打开和关闭按钮(同一个按钮)获取这些数据:
Protocol=LG Address=0x88 Command=0x88C Raw-Data=0x88C0051 (28 bits)
Protocol=LG Address=0x88 Command=0x880 Raw-Data=0x880059E (28 bits)
Protocol=LG Address=0x88 Command=0x88C Raw-Data=0x88C0051 (28 bits)
为什么我从同一个按钮(提高音量和打开/关闭)获取两个原始数据
我应该在 sAddress 中插入 Rawd-Data 吗?:
// Some protocols have 5,some 8 and some 16 bit Address
uint16_t sAddress = 0x880059E;
uint8_t sCommand = 0x28;
uint8_t sRepeats = 0;
这是发送的完整代码:
#include <IRremote.h>
#if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtiny167__)
#include "ATtinySerialOut.h"
#endif
irsend irsender;
// On the Zero and others we switch explicitly to SerialUSB
#if defined(ARDUINO_ARCH_SAMD)
#define Serial SerialUSB
#endif
void setup() {
pinMode(LED_BUILTIN,OUTPUT);
Serial.begin(115200);
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_USB) || defined(SERIAL_PORT_USBVIRTUAL)
delay(2000); // To be able to connect Serial monitor after reset and before first printout
#endif
// Just to kNow which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
Serial.print(F("Ready to send IR signals at pin "));
Serial.println(IR_SEND_PIN);
Serial.println(F("Send with standard protocol encoders"));
}
// Some protocols have 5,some 8 and some 16 bit Address
uint16_t sAddress = 0x0102;
uint8_t sCommand = 0x34;
uint8_t sRepeats = 0;
void loop() {
/*
* Print values
*/
Serial.println();
Serial.print(F("address=0x"));
Serial.print(sAddress,HEX);
Serial.print(F(" command=0x"));
Serial.print(sCommand,HEX);
Serial.print(F(" repeats="));
Serial.print(sRepeats);
Serial.println();
Serial.println(F("Send NEC with 8 bit address"));
irsender.sendNECStandard(sAddress,sCommand,false,sRepeats);
delay(2000);
Serial.println(F("Send NEC with 16 bit address"));
irsender.sendNECStandard(sAddress,true,sRepeats);
delay(2000);
Serial.println(F("Send Panasonic"));
irsender.sendPanasonicStandard(sAddress,sRepeats);
delay(2000);
Serial.println(F("Send Kaseikyo with 0x4711 as vendor ID"));
irsender.sendKaseikyoStandard(sAddress,0x4711,sRepeats);
delay(2000);
Serial.println(F("Send Denon"));
irsender.sendDenonStandard(sAddress,sRepeats);
delay(2000);
Serial.println(F("Send Denon/Sharp variant"));
irsender.sendSharpStandard(sAddress,sRepeats);
delay(2000);
Serial.println(F("Send Sony/SIRCS with 7 command and 5 address bits"));
irsender.sendSonyStandard(sAddress,sRepeats);
delay(2000);
Serial.println(F("Send Sony/SIRCS with 7 command and 13 address bits"));
irsender.sendSonyStandard(sAddress,sRepeats);
delay(2000);
Serial.println(F("Send Samsung"));
irsender.sendSamsungStandard(sAddress,sRepeats);
delay(2000);
Serial.println(F("Send JVC"));
irsender.sendJVCStandard(sAddress,sRepeats);
delay(2000);
Serial.println(F("Send LG"));
irsender.sendLGStandard(sAddress,sRepeats);
delay(2000);
Serial.println(F("Send Bosewave with 8 command bits"));
irsender.sendBoseWaveStandard(sCommand,sRepeats);
delay(2000);
/*
* !!LEGO is difficult to receive because of its short marks and spaces!!!
*/
Serial.println(F("Send Lego with 2 channel and with 4 command bits"));
irsender.sendLegoPowerFunctions(sAddress,LEGO_MODE_COMBO,true);
delay(2000);
/*
* Increment values
*/
sAddress += 0x0101;
sCommand += 0x11;
sRepeats++;
// clip repeats at 3
if (sRepeats > 3) {
sRepeats = 3;
}
delay(5000); // second additional delay between each values
}
开启命令会起作用,但关闭、摆动、温度不会有任何影响。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)