Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. NodeManager
  4. Newbie, adding more than one relay to nodemanager

Newbie, adding more than one relay to nodemanager

Scheduled Pinned Locked Moved NodeManager
7 Posts 2 Posters 1.4k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • MGHaffM Offline
    MGHaffM Offline
    MGHaff
    wrote on last edited by MGHaff
    #1

    I just started using nodemanager. GREAT WORK! Might be a dumb question but how do i add more than one relay to the sketch? I would like to control 4 but only can get one to work. Thanks in advance!

    U 1 Reply Last reply
    1
    • MGHaffM MGHaff

      I just started using nodemanager. GREAT WORK! Might be a dumb question but how do i add more than one relay to the sketch? I would like to control 4 but only can get one to work. Thanks in advance!

      U Offline
      U Offline
      user2684
      Contest Winner
      wrote on last edited by
      #2

      Hi @mghaff, just add additional instances of the relay and you can configure them individually. E.g.

      #include <sensors/SensorRelay.h>
      SensorRelay relay1(4);
      SensorRelay relay2(5);
      SensorRelay relay3(6);
      
      MGHaffM 3 Replies Last reply
      2
      • U user2684

        Hi @mghaff, just add additional instances of the relay and you can configure them individually. E.g.

        #include <sensors/SensorRelay.h>
        SensorRelay relay1(4);
        SensorRelay relay2(5);
        SensorRelay relay3(6);
        
        MGHaffM Offline
        MGHaffM Offline
        MGHaff
        wrote on last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • U user2684

          Hi @mghaff, just add additional instances of the relay and you can configure them individually. E.g.

          #include <sensors/SensorRelay.h>
          SensorRelay relay1(4);
          SensorRelay relay2(5);
          SensorRelay relay3(6);
          
          MGHaffM Offline
          MGHaffM Offline
          MGHaff
          wrote on last edited by
          #4

          @user2684 Perfect Thanks!

          1 Reply Last reply
          0
          • U user2684

            Hi @mghaff, just add additional instances of the relay and you can configure them individually. E.g.

            #include <sensors/SensorRelay.h>
            SensorRelay relay1(4);
            SensorRelay relay2(5);
            SensorRelay relay3(6);
            
            MGHaffM Offline
            MGHaffM Offline
            MGHaff
            wrote on last edited by MGHaff
            #5

            @user2684 Another Question.... Thanks in advance!
            Where do i put this to get my relay to invert operation?
            // [109] Invert the value to write. E.g. if ON is received, write LOW (default: false)
            void setInvertValueToWrite(bool value);

            And how should it be written.

            I tried this.
            #include <sensors/SensorRelay.h>
            SensorRelay relay1(8);
            SensorRelay relay2(5);
            SensorRelay relay3(6);
            SensorRelay relay4(7);
            // [109] Invert the value to write. E.g. if ON is received, write LOW (default: false)
            SensorRelay setInvertValueToWrite(true);

            U 1 Reply Last reply
            0
            • MGHaffM MGHaff

              @user2684 Another Question.... Thanks in advance!
              Where do i put this to get my relay to invert operation?
              // [109] Invert the value to write. E.g. if ON is received, write LOW (default: false)
              void setInvertValueToWrite(bool value);

              And how should it be written.

              I tried this.
              #include <sensors/SensorRelay.h>
              SensorRelay relay1(8);
              SensorRelay relay2(5);
              SensorRelay relay3(6);
              SensorRelay relay4(7);
              // [109] Invert the value to write. E.g. if ON is received, write LOW (default: false)
              SensorRelay setInvertValueToWrite(true);

              U Offline
              U Offline
              user2684
              Contest Winner
              wrote on last edited by
              #6

              @mghaff inside before() you have to call the function setInvertValueToWrite() on the relay you want to apply it to. E.g.

              relay1.setInvertValueToWrite(true);
              relay2.setInvertValueToWrite(true);
              .....
              
              1 Reply Last reply
              1
              • MGHaffM Offline
                MGHaffM Offline
                MGHaff
                wrote on last edited by
                #7

                @user2684 said in Newbie, adding more than one relay to nodemanager:

                relay1.setInvertValueToWrite(true);
                relay2.setInvertValueToWrite(true);

                WOW Thanks Again! This is really fun and easy to work with! Thank you!!!!

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                10

                Online

                11.7k

                Users

                11.2k

                Topics

                113.1k

                Posts


                Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • MySensors
                • OpenHardware.io
                • Categories
                • Recent
                • Tags
                • Popular