Navigation

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

    Topics created by 1kohm

    • 1kohm

      Help to optimize my sketch
      General Discussion • • 1kohm  

      9
      0
      Votes
      9
      Posts
      839
      Views

      1kohm

      @rejoe2 Hi, Thanks for feedback, I'll try code from alowhum first.
    • 1kohm

      Gas Meter
      Troubleshooting • • 1kohm  

      1
      0
      Votes
      1
      Posts
      1309
      Views

      No one has replied

    • 1kohm

      Gateway update?
      General Discussion • • 1kohm  

      7
      0
      Votes
      7
      Posts
      1509
      Views

      1kohm

      topic to close. I've neede to allow new hardware to add in Domoticz.
    • 1kohm

      Dust sensor and wrong values
      Bug Reports • • 1kohm  

      6
      0
      Votes
      6
      Posts
      2976
      Views

      1kohm

      @mfalkvidd, Thanks! Works like a charm now! I've included now DHT sensor in this sketch as well Testing so far. So, another question To tell sketch when to send data I'm using: unsigned long SLEEP_TIME = 1000; Now it's sending every 1 second. But my goal is to change it to send data only when there's a value change. I've found following code (it's for Dallas temp sensor), that is sending only changed values: void loop() { // Fetch temperatures from Dallas sensors sensors.requestTemperatures(); // query conversion time and sleep until conversion completed int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution()); // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater) sleep(conversionTime); // Read temperatures and send them to controller for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) { // Fetch and round temperature to one decimal float temperature = static_cast<float>(static_cast<int>((getConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.; // Only send data if temperature has changed and no error #if COMPARE_TEMP == 1 if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) { #else if (temperature != -127.00 && temperature != 85.00) { #endif // Send in the new temperature send(msg.setSensor(i).set(temperature,1)); // Save new temperatures for next compare lastTemperature[i]=temperature; } How to implement it in my case? Help here would be great Best,