Skip to content

IR Recorder

Nikola Jovanovic edited this page Oct 4, 2020 · 1 revision

IR Recorder

Fully operational and reliable IR recorder is implemented in file ir-rec_main.py:

def ir_rx_callback(ir_decoded, ir_hex, valid):
        print("ir_decoded={} len={}".format(ir_decoded, len(ir_decoded)))
        print("ir_dec_hex={}".format(ir_hex))
        if valid:
            print("Valid IR code! Pressed button was: ")
            key = input()
            button_map[key] = {ir_decoded, ir_hex}
            print(button_map)
pi = pigpio.pi()
ir_rec = infrared.rx(pi, IR_PIN, ir_rx_callback, 5)

It relies on 2 imported modules pigpio and custom infrared.