0

I've connected YS-IRTM v3.06 IR receiver/transmitter using softuart like described in the project

enter image description here

For some reason with code below, IR is receiving one byte per single serial write.

I've tried to shield sensor from IR diode in case these two are interfering with each other but with no success.

How to avoid such unexpected behaviour?

s = softuart.setup(9600, 6, 5)

I_HANDLER = tmr.create()
I_HANDLER:register(900, tmr.ALARM_AUTO, function(t)
    s:write(encoder.fromHex("a1f1" .. "01fe40"))
end)
I_HANDLER:start() 

s:on("data", 3, function(data)

    print("INPUT: "..encoder.toHex(data))
end)

Output

INPUT: f1f1f1
INPUT: f1f1f1
INPUT: f1f1f1
....

Nodemcu is

NodeMCU 3.0.0.0 built on nodemcu-build.com provided by frightanic.com
    branch: master
    commit: 8d091c476edf6ae2977a5f2a74bf5824d07d6183
    release: 3.0-master_20200610
    release DTS: 202006092026
    SSL: false
    build type: integer
    LFS: 0x0 bytes total capacity
    modules: encoder,file,gpio,http,mqtt,net,node,rfswitch,sjson,softuart,tmr,uart,wifi,wifi_monitor
 build 2020-08-12 12:12 powered by Lua 5.1.4 on SDK 3.0.1-dev(fce080e)
mpapec
  • 50,217
  • 8
  • 67
  • 127
  • btw, there are no issues when only listening or only sending IR codes. – mpapec Aug 13 '20 at 19:22
  • It happens `f1` is IRTM response after successful TX of data, which then interferes with actual RX data. https://docplayer.net/101050357-Nec-infrared-codec-module-ver1-0-ys-irtm.html – mpapec Aug 14 '20 at 10:38

0 Answers0