Skip to content

Instantly share code, notes, and snippets.

@jedgarpark
Last active January 19, 2018 22:16
Show Gist options
  • Save jedgarpark/7920289fd1d19399daa908426d11f258 to your computer and use it in GitHub Desktop.
Save jedgarpark/7920289fd1d19399daa908426d11f258 to your computer and use it in GitHub Desktop.
import array
import digitalio
import pulseio
import board
import adafruit_irremote
import time
# ON = bytearray(b'\xdf \xef\x10')
ONE=bytearray(b'\xff\x02\xf7\x08 ') # this is the one key on adafruit remote
# ONE=bytearray([0xFF, 0x02, 0xF7, 0x08 ])
remote = adafruit_irremote.GenericTransmit((9145, 4500), (580, 570), (1615, 570), 570)
with pulseio.PWMOut(board.D0, frequency=38000, duty_cycle=2 ** 15) as pwm:
pulse = pulseio.PulseOut(pwm)
while True:
remote.transmit(pulse, ONE)
print('ONE')
time.sleep(5) # the nec protocol repeat timing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment