You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As written, the transceiver seems to have developed a feedback loop wherein the receiver is actually also receiving the transmitted code, which then re-transmits, etc. until a bit is dropped and the decode fails.
If the example code is modified as below, there are no errors and the receive/transmit functions seem to work as expected (on a lab bench).
# SPDX-FileCopyrightText: 2024 Liz Clark for Adafruit Industries# SPDX-License-Identifier: MITimporttimeimportarrayimportpulseioimportboardimportadafruit_irremote# Create a 'PulseOut' to send infrared signals on the IR transmitter @ 38KHzpulseout=pulseio.PulseOut(board.SCL1, frequency=38000, duty_cycle=2**15)
# Create an encoder that will take numbers and turn them into NEC IR pulsesencoder=adafruit_irremote.GenericTransmit(header=[9000, 4500],
one=[560, 1700],
zero=[560, 560],
trail=0)
# IR receiver setupir_receiver=pulseio.PulseIn(board.SDA1, maxlen=120, idle_state=True)
decoder=adafruit_irremote.GenericDecode()
skip_next=FalsewhileTrue:
pulses=decoder.read_pulses(ir_receiver)
try:
ifnotskip_next:
# Attempt to decode the received pulsesreceived_code=decoder.decode_bits(pulses)
ifreceived_code:
hex_code=''.join(["%02X"%xforxinreceived_code])
print(f"Received: {hex_code}")
# Convert pulses to an array of type 'H' (unsigned short)pulse_array=array.array('H', pulses)
# send code back using original pulsespulseout.send(pulse_array)
print(f"Sent: {pulse_array}")
skip_next=Trueelse:
skip_next=Falseexceptadafruit_irremote.IRNECRepeatException: # Signal was repeated, ignorepassexceptadafruit_irremote.IRDecodeException: # Failed to decode signalprint("Error decoding")
ir_receiver.clear() # Clear the receiver buffertime.sleep(1) # Delay to allow the receiver to settleprint()
Note that if the read and write functions are "decoupled" (e.g. record and playback), the device works as each of the counterparts.
The text was updated successfully, but these errors were encountered:
Ref:
As written, the transceiver seems to have developed a feedback loop wherein the receiver is actually also receiving the transmitted code, which then re-transmits, etc. until a bit is dropped and the decode fails.
If the example code is modified as below, there are no errors and the receive/transmit functions seem to work as expected (on a lab bench).
Note that if the
read
andwrite
functions are "decoupled" (e.g. record and playback), the device works as each of the counterparts.The text was updated successfully, but these errors were encountered: