infrared - IR Hex to Raw IR code conversion -
how hex ir code
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 003f 0015 0702 00a9 00a8 0015 0015 0015 0e6e
into raw ir code this
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);
the first 4 numbers there have special meaning:
- 1 - 0000 indicates raw ir data (you can ignore value)
- 2 - frequency
- 3 - length of first burst pair sequence
- 4 - length of second burst pair sequence
the frequency particularly important. lg wants frequency in hz, might expect, hex code in terms of pronto internal clock. conversion be:
carrierfrequency = 1000000/(hexfreq * .241246)
to rest of code, after 4 digit preamble, lg wants in μs, hex code has them in terms of frequency. you'll need convert each of them:
pulselength = 1000000*(hexpulse/carrierfrequency)
i'm not sure whether want send whole thing, or first or second burst sequence. second repeat sequence, used long button presses , like. keep in mind, these in terms of pairs, not individual numbers. 00a9 00a8
1 burst pair (on time, off time). in case:
- first sequence:
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
- second sequence:
00a9 00a8 0015 0015 0015 0e6e
sidenote: distinct pair front, , large value @ end typical. makes easy eyeball without having count.
so, lay out steps:
array numbers = split hexcode on space (ignore numbers[0]) carrierfrequency = 1000000/(numbers[1] * .241246) codelength = numbers[2] repeatcodelength = numbers[3] (number in numbers[4 end]) { convertedtomicrosec = 1000000*(number/carrierfrequency) fullsequenceconverted.add(convertedtomicrosec) } sequence1endpoint = 2 * codelength sequence2endpoint = sequence1endpoint + 2 * repeatcodelength firstsequence = fullsequenceconverted index 0 sequence1endpoint secondsequence = fullsequenceconverted sequence1endpoint sequence2endpoint mir.sendirpattern(carrierfrequency, firstsequence)
Comments
Post a Comment