Navigation

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

    Topics created by ihtgtwtd

    • ihtgtwtd

      Binary switch code written for 1.5.4
      Troubleshooting • • ihtgtwtd  

      5
      0
      Votes
      5
      Posts
      1154
      Views

      ihtgtwtd

      No, of course not. Here you go, have fun everyone #define MY_DEBUG #define MY_RADIO_NRF24 #include <MySensors.h> #include <SPI.h> #include <Bounce2.h> #define SKETCH_NAME "Binary Sensor" #define SKETCH_MAJOR_VER "1" #define SKETCH_MINOR_VER "0" #define first_CHILD_ID 0 #define second_CHILD_ID 1 #define third_CHILD_ID 2 #define fourth_CHILD_ID 3 #define fifth_CHILD_ID 4 #define sixth_CHILD_ID 5 #define NUMBER_OF_SWITCHES 6 Bounce debouncer[NUMBER_OF_SWITCHES]; int oldValue[NUMBER_OF_SWITCHES]; byte switchPin[NUMBER_OF_SWITCHES] = {3,4,5,6,7,8}; //<<<<<<<<<<< set your switch pins here MyMessage msg(0,V_STATUS); void setup() { for (int i = 0; i < NUMBER_OF_SWITCHES; i++) { pinMode(switchPin[i],INPUT_PULLUP); debouncer[i] = Bounce(); debouncer[i].attach(switchPin[i]); debouncer[i].interval(5); } for (int i = 0; i < NUMBER_OF_SWITCHES; i++) { present(i, S_BINARY); delay(250); } } // void loop() { for (int i = 0; i < NUMBER_OF_SWITCHES; i++) { debouncer[i].update(); int value = debouncer[i].read(); if (value != oldValue[i]) { send(msg.setSensor(i).set(value == HIGH? true : false), false); } oldValue[i] = value; } }
    • ihtgtwtd

      problem with implementation of my sensors in rollershutter sketch
      Troubleshooting • • ihtgtwtd  

      13
      0
      Votes
      13
      Posts
      2259
      Views

      ihtgtwtd

      well thanks, I already tried that because it looked suspicious but i was sending on switch 1 in domoticz and did not create a switch for 0. So it seems this thing works, thanks again for your help and the patience to deal with my noob questions