/pico-ir

IR library for Raspberry Pi Pico

Primary LanguagePythonApache License 2.0Apache-2.0

Pico IR

Lint License: MIT

Complete IR library for Raspberry Pico

Warning

Remember to check your modules' voltage, you might need logic level converter to convert between 3v3 and 5v!

Example

import utime
from machine import Pin
from pico_ir import read_code, send_code, validate_code, InvalidCodeException

pin_in = Pin(20, Pin.IN, Pin.PULL_UP)
pin_out = Pin(21, mode=Pin.OUT)

while True:
    out = read_code(pin_in)
    # ignore random signals 
    if out:
        try:
            validate_code(out)
            print(out)
            utime.sleep(3)
            send_code(pin_out, out)
        except InvalidCodeException:
            print("InvalidCodeException:" + out)