Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. Jacek Slawinski
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Jacek Slawinski

    @Jacek Slawinski

    0
    Reputation
    3
    Posts
    329
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Jacek Slawinski Follow

    Best posts made by Jacek Slawinski

    This user hasn't posted anything yet.

    Latest posts made by Jacek Slawinski

    • RE: Motion sensors

      Hi
      I have coneccted the arduino mega to RPI 3 via usb
      I can not handle the script on more than one motion sensor

      #define MY_DEBUG 
      
      
      
      
      // Enable serial gateway
      #define MY_GATEWAY_SERIAL
      
      // Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
      #if F_CPU == 8000000L
      #define MY_BAUD_RATE 38400
      #endif
      
      
      
      // Enable inclusion mode
      #define MY_INCLUSION_MODE_FEATURE
      // Enable Inclusion mode button on gateway
      #define MY_INCLUSION_BUTTON_FEATURE
      
      
      
      // Set inclusion mode duration (in seconds)
      #define MY_INCLUSION_MODE_DURATION 60 
      // Digital pin used for inclusion mode button
      #define MY_INCLUSION_MODE_BUTTON_PIN  3 
      
      
      #include <SPI.h>
      #include <MySensors.h>  
      #include <Bounce2.h>
      
      unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
      #define DIGITAL_INPUT_SENSOR 6   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
      #define CHILD_ID 1   // Id of the sensor child
      #define DIGITAL_INPUT_SENSOR_2 7   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
      #define CHILD_ID_2 2   // Id of the sensor child
      
      // Initialize motion message
      MyMessage msg(CHILD_ID, V_TRIPPED);
      MyMessage msg2(CHILD_ID_2, V_TRIPPED);
      
      void setup()
      {
          pinMode(DIGITAL_INPUT_SENSOR, INPUT);      // sets the motion sensor digital pin as input
          pinMode(DIGITAL_INPUT_SENSOR_2, INPUT); 
      }
      
      void presentation()
      {
          // Send the sketch version information to the gateway and Controller
          sendSketchInfo("Motion Sensor", "1.0");
      
          // Register all sensors to gw (they will be created as child devices)
          present(CHILD_ID, S_MOTION);
          present(CHILD_ID_2, S_MOTION);
      }
      
      void loop()
      {
        {
          // Read digital motion value
          bool tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH;
      
          Serial.println(tripped);
          send(msg.set(tripped?"1":"0"));  // Send tripped value to gw
      
          // Sleep until interrupt comes in on motion sensor. Send update every two minute.
          
      }
      {// Read digital motion value
          bool tripped = digitalRead(DIGITAL_INPUT_SENSOR_2) == HIGH;
      
          Serial.println(tripped);
          send(msg2.set(tripped?"1":"0"));  // Send tripped value to gw
          sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE,digitalPinToInterrupt(DIGITAL_INPUT_SENSOR_2), CHANGE, SLEEP_TIME);
      }
      }
      

      This script generates a lot of different sensors in the domoticz and should only two.
      I don't now why? 😞

      When it erases:

       sleep(digitalPinToInterrupt(CzujnikRuchu1), CHANGE, digitalPinToInterrupt(CzujnikRuchu2), CHANGE, SLEEP_TIME); ``````
      
      

      It's the same

      Could you help me with this?

      posted in Domoticz
      Jacek Slawinski
      Jacek Slawinski
    • RE: Motion sensors

      Thank you very much
      It works
      I add this

      sleep(digitalPinToInterrupt(CzujnikRuchu1), CHANGE, digitalPinToInterrupt(CzujnikRuchu2), CHANGE, SLEEP_TIME);``````
      Insert Code Here
      

      However, in the devices from time to time themselves add new ones not used.
      I don't know why

      foto

      posted in Domoticz
      Jacek Slawinski
      Jacek Slawinski
    • Motion sensors

      Hi all
      Could you please help me?
      I want to hook more than one motion detector to arduino.
      In the program I see both sensors and contatron
      The first motion sensor works and the second one does not change states
      Contatron works
      What's wrong with the scripts?

      https://pastebin.com/baMUK4zj

      posted in Domoticz
      Jacek Slawinski
      Jacek Slawinski