我如何获得此十六进制 IR 代码
0000 006D 0022 0003 00A9 00a8 0015 003F 0015 003F 0015 003F 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 003F 0015 003F 0015 003F 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 003F 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0015 0015 003f 0015 003f 0015 003f 0015 003f 0015 003f 0015 0a 0f 0a 003f 00a 003f 00a 0015 0 10 0 1 0e 0015 0 1 0 0 1 0 0 1 0 2 0
变成这样的原始 IR 代码
int[] irdata = {4600,4350,700,1550,650,1550,650,1600,650,450,650,450,650,450,650,450,700,400,700,1550,650,1550,650,1600,650,450,650,450,650,450,700,450,650,450,650,450,650,1550,700,450,650,450,650,450,650,450,650,450,700,400,650,1600,650,450,650,1550,650,1600,650,1550,650,1550,700,1550,650,1550,650};
mIR.sendIRPattern(37470, irdata);
Run Code Online (Sandbox Code Playgroud)
那里的前四个数字有特殊含义:
频率将特别重要。正如您所料,LG 想要以赫兹为单位的频率,但您的十六进制代码是根据 Pronto 内部时钟。转换将是:
carrierfrequency = 1000000/(HexFreq * .241246)
Run Code Online (Sandbox Code Playgroud)
对于代码的其余部分,在四位前导码之后,LG 想要那些在 ?s 中的,十六进制代码在频率方面有它们。您需要转换它们中的每一个:
pulselength = 1000000*(HexPulse/carrierfrequency)
Run Code Online (Sandbox Code Playgroud)
我不确定您是要发送整个内容,还是只发送第一个或第二个突发序列。第二个是重复序列,用于长按按钮等。但请记住,这些是成对的,而不是单个数字。 00a9 00a8是一个突发对(准时,关时)。在这种情况下:
00a9 00a8 0015 003f 0015 003f 0015 003f 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 003f 0015 003f 0015 003f 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 003f 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0015 0040 0015 0015 0015 003f 0015 003f 0015 003f 0015 003f 0015 003f 0015 003f 0015 070200a9 00a8 0015 0015 0015 0e6e旁注:前面的不同对和末尾的非常大的值是非常典型的。无需数数即可轻松吸引眼球。
因此,要布置步骤:
array numbers = Split hexcode on space
(ignore numbers[0])
carrierFrequency = 1000000/(numbers[1] * .241246)
codeLength = numbers[2]
repeatCodeLength = numbers[3]
for (number in numbers[4 to end]) {
convertedToMicrosec = 1000000*(number/carrierFrequency)
fullSequenceConverted.add(convertedToMicrosec)
}
sequence1EndPoint = 2 * codeLength
sequence2EndPoint = sequence1EndPoint + 2 * repeatCodeLength
firstSequence = fullSequenceConverted from index 0 to sequence1EndPoint
secondSequence = fullSequenceConverted from sequence1EndPoint to sequence2EndPoint
mIR.sendIRPattern(carrierFrequency, firstSequence)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8870 次 |
| 最近记录: |