Page tree
Skip to end of metadata
Go to start of metadata


This class receives IR events. For more information, refer to the Object Reference Manual entry on roIRReceiver.

Object Creation

A BSIRReceiver object must specify the hardware interface that will receive IR events, as well as the encoding(s) to look for:

BSIRReceiver(DOMString interface, DOMString encoding)

Valid hardware interfaces include the following:

  • "GPIO": Pin 1 of the GPIO connector
  • "IR-in": The 3.5mm IR input/output connector
  • "Iguana": The Iguanaworks IR transceiver. This source can support both NEC and RC5 encodings simultaneously.


Valid encodings include the following (multiple encodings can be specified in the string using a ";"):

  • "NEC"
  • "RC5" (supported on the Iguanaworks device only)


void Close()

Shuts down the instance, preventing it from further consuming resources. If this method is not called, garbage collection determines when the instance will be destroyed.


These events are available on the BSIRReceiver object. Each event can receive an IRReceiverEvent event.

  • onremotedown
  • onremoterepeat
  • onremoteup (supported on the Iguanaworks device only)

IRReceiverEvent – Attributes

  • readonly attribute DOMString irType;
  • readonly attribute unsigned long code;


The following JavaScript example displays messages on the log when remote codes are received:

function myFunction()
    var ir_receiver = new BSIRReceiver("IR-in","NEC");

    ir_receiver.onremotedown = function(e){
        console.log('############ onremotedown: ' + e.irType + " - " + e.code);

    ir_receiver.onremoteup = function(e){
        console.log('############ onremoteup: ' + e.irType + " - " + e.code);
  • No labels