Invert command logic

Forum Home Forums Communicating with Devices Modbus Invert command logic

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3481
    Pieter
    Participant

    Hi.
    I have a relay board (active low) connected to my arduino with modbus tcp.
    The module uses a high input to switch the relay off and n low input to switch it on.
    From the command when a click ON the relay switches off and vice versa.

    Is there a way to invert the command?
    ON = 0
    OFF = 1

    #3486
    Mikhail
    Moderator

    Hi,
    Yes, use the formula for the output channel:
    Cmd > 0 ? 0 : 1

    If I did a mistake in the formula, let me know.

    #3497
    Pieter
    Participant

    Thank you. I just tested it. Now it works as I expected it to work.
    Your formula is 100% accurate.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.