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. Request node infos by arduino ide

Request node infos by arduino ide

Scheduled Pinned Locked Moved Troubleshooting
6 Posts 2 Posters 1.8k Views 1 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.
  • G Offline
    G Offline
    Gefkuz
    wrote on last edited by
    #1

    Hi all,

    I'm new in the mysensors world, and love it.
    I'm trying to make a driver in csharp with serialGateway for my application.
    I received all my two humidity sensors without any problems.
    But when I want to ask something to my sensors, they send me nothing... I don't understand what going on.

    here is the code in my sensors :

    #include <SPI.h>
    #include <MySensor.h>  
    #include <DHT.h>  
    
    #define CHILD_ID_HUM 0
    #define CHILD_ID_TEMP 1
    #define HUMIDITY_SENSOR_DIGITAL_PIN 3
    unsigned long Time_Measure = 60000; // Sleep time between reads (in seconds)
    
    MySensor gw;
    DHT dht;
    float lastTemp;
    float lastHum;
    boolean metric = true; 
    MyMessage msgHum(CHILD_ID_HUM, V_HUM);
    MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
    unsigned long timeOfLastChange = 0;
    
    void setup()  
    { 
        gw.begin(NULL, AUTO, true);
      dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN); 
    
      // Send the Sketch Version Information to the Gateway
      gw.sendSketchInfo("Atelier", "1.0");
    
      // Register all sensors to gw (they will be created as child devices)
      gw.present(CHILD_ID_HUM, S_HUM);
      gw.present(CHILD_ID_TEMP, S_TEMP);
      
      metric = gw.getConfig().isMetric;
      timeOfLastChange = millis();
    }
    
    void loop()      
    {  
      float humidity;
      float temperature;
    
      if ((millis() - timeOfLastChange) > Time_Measure)
      {
        delay(dht.getMinimumSamplingPeriod());
        temperature = dht.getTemperature();
        if (isnan(temperature)) {
            Serial.println("Failed reading temperature from DHT");
        } else if (temperature != lastTemp) {
          lastTemp = temperature;
          if (!metric) {
            temperature = dht.toFahrenheit(temperature);
          }
          gw.send(msgTemp.set(temperature, 1));
          Serial.print("T: ");
          Serial.println(temperature);
        }
        
        delay(dht.getMinimumSamplingPeriod());
        humidity = dht.getHumidity();
        if (isnan(humidity)) {
            Serial.println("Failed reading humidity from DHT");
        } else if (humidity != lastHum) {
            lastHum = humidity;
            gw.send(msgHum.set(humidity, 1));
            Serial.print("H: ");
            Serial.println(humidity);
        }
      }
      gw.process();
    }
    
    
    

    And this is an example of terminal view

    0;0;3;0;14;Gateway startup complete.
    0;0;3;0;9;read: 2-2-0 s=255,c=0,t=18,pt=0,l=5:1.4.1
    2;255;0;0;18;1.4.1
    0;0;3;0;9;read: 2-2-0 s=255,c=3,t=6,pt=1,l=1:0
    2;255;3;0;6;0
    0;0;3;0;9;read: 2-2-0 s=255,c=3,t=11,pt=0,l=7:Atelier
    2;255;3;0;11;Atelier
    0;0;3;0;9;read: 2-2-0 s=255,c=3,t=12,pt=0,l=3:1.0
    2;255;3;0;12;1.0
    0;0;3;0;9;read: 2-2-0 s=0,c=0,t=7,pt=0,l=0:
    2;0;0;0;7;
    0;0;3;0;9;read: 2-2-0 s=1,c=0,t=6,pt=0,l=0:
    2;1;0;0;6;
    0;0;3;0;9;send: 0-0-2-2 s=255,c=3,t=6,pt=0,l=1,st=ok:0
    0;0;3;0;9;read: 1-1-0 s=0,c=1,t=1,pt=7,l=5:49.6
    1;0;1;0;1;49.6
    0;0;3;0;9;send: 0-0-2-2 s=255,c=3,t=6,pt=0,l=1,st=ok:M
    0;0;3;0;9;read: 2-2-0 s=1,c=1,t=0,pt=7,l=5:24.8
    2;1;1;0;0;24.8
    0;0;3;0;9;read: 2-2-0 s=0,c=1,t=1,pt=7,l=5:46.6
    2;0;1;0;1;46.6
    0;0;3;0;9;read: 2-2-0 s=1,c=1,t=0,pt=7,l=5:24.9
    2;1;1;0;0;24.9
    0;0;3;0;9;read: 2-2-0 s=0,c=1,t=1,pt=7,l=5:46.7
    2;0;1;0;1;46.7
    0;0;3;0;9;read: 2-2-0 s=0,c=1,t=1,pt=7,l=5:46.6
    2;0;1;0;1;46.6
    0;0;3;0;9;read: 2-2-0 s=0,c=1,t=1,pt=7,l=5:46.5
    2;0;1;0;1;46.5
    0;0;3;0;9;read: 2-2-0 s=0,c=1,t=1,pt=7,l=5:46.6
    2;0;1;0;1;46.6
    0;0;3;0;9;read: 2-2-0 s=1,c=1,t=0,pt=7,l=5:25.0
    2;1;1;0;0;25.0
    0;0;3;0;9;read: 2-2-0 s=0,c=1,t=1,pt=7,l=5:46.5
    2;0;1;0;1;46.5
    
    

    What I make wrong???
    I add the gw.process on sensor code and nothing add...
    Bouhhh....:sweat: :disappointed_relieved:

    Please help me....

    1 Reply Last reply
    0
    • hekH Offline
      hekH Offline
      hek
      Admin
      wrote on last edited by
      #2

      What do you mean? The gateway log you publish contains both temperature and humidity readings from node 2.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Gefkuz
        wrote on last edited by
        #3

        Yes, you are wright. The sensor is working well.
        But Iwant to know is sketch_name, sketch_version.
        What Have I to do for it?

        1 Reply Last reply
        0
        • hekH Offline
          hekH Offline
          hek
          Admin
          wrote on last edited by
          #4
          2;255;3;0;11;Atelier
          2;255;3;0;12;1.0
          

          First line is sketch name and the second is the version reported in the sketch.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            Gefkuz
            wrote on last edited by
            #5

            Yes, this informations is sended at sensor start up.
            But I want this information later in sensor life.
            I want to ask for this information with a command via serialgateway.
            Is that Possible?

            1 Reply Last reply
            0
            • hekH Offline
              hekH Offline
              hek
              Admin
              wrote on last edited by
              #6

              You can send the information whenever you want.

              In the provided examples it is placed in the setup() method which only runs once at startup. But nothing stops you from sending the information later (for example after a incoming request message of your choice arrives).

              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.1k

              Posts


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