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
J

Jacek Slawinski

@Jacek Slawinski
About
Posts
3
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Motion sensors
    J Jacek Slawinski

    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?

    Domoticz

  • Motion sensors
    J Jacek Slawinski

    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

    Domoticz

  • Motion sensors
    J Jacek Slawinski

    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

    Domoticz
  • Login

  • Don't have an account? Register

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