The Interstacks Infrared Remote hardware block can receive and transmit infrared remote control codes. There are no infrared remote control standards. This means that the number of key codes numbers in the many thousands. Each device to be controlled from an infrared remote control uses its own unique codes. The “Key Code” output terminal sends a five byte binary array when its receiver detects an infrared command. A typical message might be: Binary(‘\x0c\xe0\xe0\xfe\xf5’). These are five (hexadecimal) binary bytes. By sending a similar five byte binary array to the “Character In” terminal, the Infrared Remote block will transmit the key code.
The Infrared Remote block has a built-in infrared receiver and transmitter behind the block’s front label, in addition to connectors on its back for two external infrared transmitters and one external infrared receiver.
A typical Python script inside a software block to examine the five byte binary key codes might be:
x = message # message from infrared remote Key Code output terminal if (x==‘\x0c’) and (x==‘\xe0) and (x==‘\xe0’): # match first 3 bytes of key code if (x==‘\x88’): I.sendmessage(2, ‘0’) if (x==‘\x60’): I.sendmessage(2, ‘1’)
Connectors on back
Looking into back:
Note that the Infrared Remote block also has a built-in infrared receiver and transmitter behind the front label.
Block properties and terminals
Type (uuid): Module Type
Version (int): Firmware Version
Power (int): External transmit power. 0 low power 1 high power. Default low power. Do not use high power with small, external IR LEDs.
“Properties” – in (List or Property Name string): To set property. Send property name, Value. For example [’N’,’netname’]. To get property, just send property name. For example. ’N’
“PResponse” – out (List or True) : On set, responds with True when done. On get, responds with list. For example [’N’, ‘netname’].
“Character Out” – out (String): One char string of interpreted IR code.
“Character In” – in (String or Binary Array): Transmit IR code for character. or Binary array. Transmit keycode. Will often be 5 byte key code.
“Key Code” – out (Binary array): Received keycode. This will often be 5 bytes but could be a several hundred byte raw run length encoded edge time sequence.