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. Library 2.0 - No Humidity sketch

Library 2.0 - No Humidity sketch

Scheduled Pinned Locked Moved Troubleshooting
8 Posts 4 Posters 1.4k Views 4 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.
  • DdawmeD Offline
    DdawmeD Offline
    Ddawme
    wrote on last edited by
    #1

    I wanted to update all my sensor to the 2.0 library but Im noticing that the Humidity sketch seems to have been removed. Is this correct?

    1 Reply Last reply
    0
    • tlpeterT Offline
      tlpeterT Offline
      tlpeter
      wrote on last edited by
      #2

      It is there and is called

      DhtTemperatureAndHumiditySensor

      1 Reply Last reply
      0
      • DdawmeD Offline
        DdawmeD Offline
        Ddawme
        wrote on last edited by
        #3

        hmm... is it possible I somehow got an incomplete library? I only have 4 sketches that begin with D and none of them are that one.

        1 Reply Last reply
        0
        • tlpeterT Offline
          tlpeterT Offline
          tlpeter
          wrote on last edited by tlpeter
          #4

          Did you download the new examples? they are not included anymore.
          Here you can find them:

          https://github.com/mysensors/MySensorsArduinoExamples/tree/master/examples

          DdawmeD 1 Reply Last reply
          2
          • tlpeterT tlpeter

            Did you download the new examples? they are not included anymore.
            Here you can find them:

            https://github.com/mysensors/MySensorsArduinoExamples/tree/master/examples

            DdawmeD Offline
            DdawmeD Offline
            Ddawme
            wrote on last edited by
            #5

            @tlpeter I had not, thanks so much! I'm still a novice when it comes to GitHub, how do I download the files?

            1 Reply Last reply
            0
            • tlpeterT Offline
              tlpeterT Offline
              tlpeter
              wrote on last edited by
              #6

              I don't know either and i remember that there should be a zip file which you can download.
              I only cannot remember where.
              For now you can copy the code and save it.

              1 Reply Last reply
              1
              • mfalkviddM Online
                mfalkviddM Online
                mfalkvidd
                Mod
                wrote on last edited by mfalkvidd
                #7

                The zip download link is a bit hard to find because it is only visible at the top level of the project (not in subfolders). Keep in mind that the sketch depends on the dht library so you'll need to download the zip file. Just the sketch might not work.
                0_1471535995682_image.png

                1 Reply Last reply
                2
                • Tagore.PDET Offline
                  Tagore.PDET Offline
                  Tagore.PDE
                  wrote on last edited by
                  #8
                  // Enable debug prints to serial monitor
                  #define MY_DEBUG 
                  
                  // Enable and select radio type attached
                  #define MY_RADIO_NRF24
                  //#define MY_RADIO_RFM69
                  
                  //Including nescessary libraries
                  #include <SPI.h>
                  #include <MySensors.h> 
                  #include <DHT.h>  
                  #define HUMIDITY 1
                  #define TEMPERATURE 2
                  
                  #define HUMIDITY_SENSOR_DIGITAL_PIN 3
                  DHT dht;
                  
                  float lastTempValue;
                  float lastHumValue;
                  boolean metric = true; 
                  
                  unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)(30 seconds)
                  #define MESSAGEWAIT 500
                  
                  MyMessage msgHum(HUMIDITY, V_HUM);
                  MyMessage msgTemp(TEMPERATURE, V_TEMP);
                  
                  void presentation()  {
                    // Send the sketch version information to the gateway and Controller
                    sendSketchInfo("XXXX", "XX");
                    wait(MESSAGEWAIT);
                  
                    // Register all sensors to gateway (they will be created as child devices)
                    present(HUMIDITY, S_HUM);
                    wait(MESSAGEWAIT);
                    present(TEMPERATURE, S_TEMP);
                    wait(MESSAGEWAIT);
                  }
                  
                  void setup() {
                     dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN);
                  }
                  
                  void loop() {
                              delay(dht.getMinimumSamplingPeriod());
                              float temperature = dht.getTemperature();
                              if (isnan(temperature)) {
                                                      Serial.println("Failed reading temperature from DHT");
                                                      } else if (temperature != lastTempValue) {
                                                                                            send(msgTemp.set(temperature, 1));
                                                                                            lastTempValue = temperature;
                                                                                            Serial.print("Temp: ");
                                                                                            Serial.println(temperature);
                                                                                          }
                              float humidity = dht.getHumidity();
                               if (isnan(humidity)) {
                                                    Serial.println("Failed reading humidity from DHT");
                                                    } else if (humidity != lastHumValue) {
                                                                                     send(msgHum.set(humidity, 1));
                                                                                     lastHumValue = humidity;
                                                                                     Serial.print("Hum: ");
                                                                                     Serial.println(humidity);
                                                                                    } 
                  
                              sleep(SLEEP_TIME);
                             }
                  
                  
                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  14

                  Online

                  11.7k

                  Users

                  11.2k

                  Topics

                  113.0k

                  Posts


                  Copyright 2019 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