Flic Home

    Community

    • Login
    • Search
    • Popular
    • Users

    Example code for IR signal?

    Developers
    2
    4
    528
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • jakekapsandy
      jakekapsandy last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • Emil
        Emil FlicTeam @jakekapsandy last edited by

        @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);
        });
        
        1 Reply Last reply Reply Quote 0
        • jakekapsandy
          jakekapsandy @Emil last edited by

          @Emil No I was just looking for an example of the array mentioned here.

          Emil 1 Reply Last reply Reply Quote 0
          • Emil
            Emil FlicTeam last edited by

            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?

            jakekapsandy 1 Reply Last reply Reply Quote 0
            • First post
              Last post