NEC RX & TX Component
Posted: Sun Aug 30, 2026 10:50 pm
I have created a NEC infrared component that can either decode data on the signal pin of VS1838B type of component.
The reason being Amazon UK sells 6 receivers for less than £5.
Plus the receiver and remotes are supplied in Arduino and ESP32 Kits ,e.g. by ELEGOO.
TX transmits the 38KHz required that is supplied to an IR LED
Installing the NEC_IR Component
The reason being Amazon UK sells 6 receivers for less than £5.
Plus the receiver and remotes are supplied in Arduino and ESP32 Kits ,e.g. by ELEGOO.
TX transmits the 38KHz required that is supplied to an IR LED
Installing the NEC_IR Component
- Place the attached component (NEC_IR.fcpx) into a folder, e.g. "Flowcode Custom Components".
- In Flowcode: File > Global Settings > Locations tab > add that folder path under "Look for components in..." (add a semicolon suffix to include subfolders).
- File > Reload.
- Component Libraries > right-click "NEC IR TX/RX 38KHz" > Details, to confirm it's loaded from the right folder. You'll find it under Comms > Wireless, or by searching "RX".
- PWM1's output pin (drives the TX IR LED) and the pin you select for your IOC interrupt (reads the RX receiver module) must be different physical pins — never the same one.
- Add an Interrupt icon to your flowchart, then double-click it to open its properties. Set Interrupt on to IOC, then click Create New Macro. In the pin list that appears, select the physical pin your receiver module is wired to (this is the IOC pin), then click OK. Click Edit Macro to open the new interrupt macro that was just created for you.
- In that newly created macro, add a call to NEC_IR1::ProcessEdge(Mode) so it runs on every edge (Mode: 1=Address, 2=Command, 3=both packed as Address256+Command).
- Back on the Interrupt icon's Properties dialog, set Trigger on change to Both Edges — not rising or falling only. NEC decoding needs to see both, since a mark and a space are told apart by which way the signal just transitioned.
- Set the component's RX Pin property to exactly the same pin you selected as the IOC pin above. These are two separate settings that must match: the Interrupt icon controls which pin wakes your ISR; RX Pin controls which pin ProcessEdge() itself reads to tell a mark from a space. Getting this wrong can silently fail to decode, or "accidentally" appear to work — don't rely on that.
- Call NEC_IR1::Initialise() once at startup, before transmitting or receiving.
- If driving the TX LED through an inverting stage (e.g. a PNP transistor), tick the "Invert Output (PNP driver)" property under Transmit Options.