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. Troubleshooting
  3. How do I turn a Pin to HIGH from controller?

How do I turn a Pin to HIGH from controller?

Scheduled Pinned Locked Moved Troubleshooting
3 Posts 3 Posters 1.1k 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.
  • Cliff KarlssonC Offline
    Cliff KarlssonC Offline
    Cliff Karlsson
    wrote on last edited by
    #1

    I thought it would be really easy but I can't understand how to do this simple task. I have a Led connected so if Pin 9 = High it turns on.

    But how can I write the sketch so that I can control the Led from my controller (domoticz) ?

    I have started with this by modifying the motion-sketch:

    #define DIGITAL_INPUT_SENSOR 3   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
    #define LIGHT_PIN 9
    
    #define CHILD_ID 1   // Id of the sensor child
    #define SECONDARY_CHILD_ID 4
    
    // Initialize motion message
    MyMessage msg(CHILD_ID, V_TRIPPED);
    MyMessage msg2(SECONDARY_CHILD_ID, V_LIGHT);
    void setup()  
    {  
      pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
      pinMode(LIGHT_PIN, OUTPUT);
    
      
    }
    
    void presentation()  {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Motion Sensor ikea", "1.0");
    
      // Register all sensors to gw (they will be created as child devices)
      present(CHILD_ID, S_MOTION);
      present(SECONDARY_CHILD_ID, S_LIGHT); 
    }
    }
    

    But nothing happens when I press the on/off switch that appears in domoticz witch kind of makes sense as I guess I need to add something in the loop. But how do do that? Are there some kind of " if [message-from-controller] then do this - command?

    And why does not the PIR show up in domoticz? I have only added a few lines, does that disable the original PIR code in someway.

    1 Reply Last reply
    0
    • F Offline
      F Offline
      fets
      wrote on last edited by
      #2

      @Cliff-Karlsson you need to manage incoming message from gateway/controller : (function void receive(const MyMessage &message) { ...}) and to chage pin state according message .
      See this example.

      And why does not the PIR show up in domoticz?

      I thing that domoticz needs at least 1 data message to show device

      1 Reply Last reply
      0
      • nielsokkerN Offline
        nielsokkerN Offline
        nielsokker
        wrote on last edited by
        #3

        There is an example that exactly gives you what you need. The Relay example is the structure of what you need to use.

        1 Reply Last reply
        0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        15

        Online

        12.0k

        Users

        11.2k

        Topics

        113.4k

        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