Example code for IR signal?
-
Curious if anyone has an example of the array containing an IR power on/off signal, I've been trying to replicate the function of a remote that is broken but I'm struggling to build the signal properly.
-
@jakekapsandy here is an example:
var ir = require('ir'); var arr = [48256, 7029, 3405, 418, 445, 418, 445, 418, 445, 421, 445, 421, 448, 418, 445, 421, 445, 416, 445, 421, 445, 418, 445, 418, 445, 418, 445, 424, 1293, 418, 1296, 416, 448, 418, 445, 426, 445, 424, 1296, 421, 445, 416, 445, 421, 445, 424, 445, 418, 445, 421, 445, 418, 1293, 424, 445, 421, 1293, 416, 1293, 418, 1293, 424, 1293, 421, 1293, 418, 1293, 421, 34946, 7053, 1709, 421]; ir.play(new Uint32Array(arr), function(error) { console.log(error); });
-
@Emil No I was just looking for an example of the array mentioned here.
-
The documentation says the following:
The first element of the array should contain a carrier frequency in Hz (usually 38000 Hz). The following elements indicate in microseconds how long each pulse should be active or silent, alternating. The first of these represents how long time the IR LEDs are on, the second how long they are off, the third how long time on and so on. The last one must represent an on part. Therefore the length of the array must be even. If another play is started before a previous one has completed, it gets enqueued and starts as soon as the previous completes (max 100 enqueued signals). If the IR is currently recording, the play is also enqueued.
Is anything here unclear that needs more detailed explanation?