【问题标题】:IR Hex to Raw IR code conversionIR Hex 到 Raw IR 代码转换
【发布时间】:2014-09-10 17:16:44
【问题描述】:

我如何获得这个 Hex IR 代码

0000 006D 0022 0003 003F 0015 0015 0015 0015 0015 0015 0015 001,000

像这样进入原始 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);

【问题讨论】:

  • 看来您已经掌握了。你到底在问什么?这是一个编程问题吗?你有你尝试过的代码吗?你还在用什么语言?
  • 我猜这是指com.lge.hardware.IRBlaster,所以我继续并用lg标记了这个问题。

标签: infrared lg


【解决方案1】:

前四个数字有特殊含义:

  • 1 - 0000 表示原始 IR 数据(您可以忽略此值)
  • 2 - 频率
  • 3 - 第一个突发对序列的长度
  • 4 - 第二个突发对序列的长度

频率将特别重要。正如您所料,LG 想要以 Hz 为单位的频率,但您的十六进制代码是根据 Pronto 内部时钟。转换将是:

carrierfrequency = 1000000/(HexFreq * .241246)

对于代码的其余部分,在四位前导码之后,LG 想要以 μs 为单位的那些,其中十六进制代码在频率方面具有它们。您需要转换它们中的每一个:

pulselength = 1000000*(HexPulse/carrierfrequency)

我不确定您是只想发送整个内容,还是只发送第一个或第二个突发序列。第二个是重复序列,用于长按按钮等。但请记住,这些是,而不是单个数字。 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 0702
  • 第二个序列:00a9 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)

【讨论】:

  • 这是一个script,用于将 pronto 转换为 raw
猜你喜欢
  • 2012-01-23
  • 2019-08-30
  • 1970-01-01
  • 1970-01-01
  • 2019-01-02
  • 2014-07-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多