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. [Solved] API 2.0 void receive(const MyMessage& message) Problem

[Solved] API 2.0 void receive(const MyMessage& message) Problem

Scheduled Pinned Locked Moved Troubleshooting
8 Posts 2 Posters 2.3k Views 2 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.
  • paqorP Offline
    paqorP Offline
    paqor
    wrote on last edited by tekka
    #1

    Hello, unfortunately is triggered no message here. The "textField" I applied and it is also available with a value. It is not even the "println" will be displayed. What am I doing wrong?

    sleep(SLEEP_TIME); //sleep for: sleepTime
    }
    //incomingMessage_____________________________________________________
    void receive(const MyMessage& message)
    {
      gasSensor.setR0(R0C);
     Serial.println(F("Incoming Message:"));
    }
    
    TheoLT 1 Reply Last reply
    0
    • paqorP paqor

      Hello, unfortunately is triggered no message here. The "textField" I applied and it is also available with a value. It is not even the "println" will be displayed. What am I doing wrong?

      sleep(SLEEP_TIME); //sleep for: sleepTime
      }
      //incomingMessage_____________________________________________________
      void receive(const MyMessage& message)
      {
        gasSensor.setR0(R0C);
       Serial.println(F("Incoming Message:"));
      }
      
      TheoLT Online
      TheoLT Online
      TheoL
      Contest Winner
      wrote on last edited by
      #2

      @paqor I wouldn't put sensor readings in a message handler. Could you try this, just to test the messages?

      wait(SLEEP_TIME); //sleep for: sleepTime // byTheo: Changed
      }
      //incomingMessage_____________________________________________________
      void receive(const MyMessage& message)
      {
      //  gasSensor.setR0(R0C);  // byTheo: Changed
      // Serial.println(F("Incoming Message:")); // byTheo: Changed
      Serial.println("Incoming Message:");
      }
      

      And I also advice not to use sleep when having a node that can receive messages.

      1 Reply Last reply
      2
      • paqorP Offline
        paqorP Offline
        paqor
        wrote on last edited by
        #3

        VIELEN VIELEN DANK!!!!
        Thanks alot:smiley:

        TheoLT 1 Reply Last reply
        0
        • paqorP paqor

          VIELEN VIELEN DANK!!!!
          Thanks alot:smiley:

          TheoLT Online
          TheoLT Online
          TheoL
          Contest Winner
          wrote on last edited by
          #4

          @paqor That it solve your problem?

          paqorP 1 Reply Last reply
          0
          • TheoLT TheoL

            @paqor That it solve your problem?

            paqorP Offline
            paqorP Offline
            paqor
            wrote on last edited by paqor
            #5

            @TheoL said:

            @paqor That it solve your problem?

            Yes
            https://gleisnetze.de/2016/08/07/sensoren4sketch-v0-6-under-contrstruction/

            TheoLT 1 Reply Last reply
            1
            • paqorP paqor

              @TheoL said:

              @paqor That it solve your problem?

              Yes
              https://gleisnetze.de/2016/08/07/sensoren4sketch-v0-6-under-contrstruction/

              TheoLT Online
              TheoLT Online
              TheoL
              Contest Winner
              wrote on last edited by
              #6

              @paqor That's great. I looked at the Sketch you posted on your site and noticed you're still using a delay. Which as short as it may be can cause messages to be missed.

              void loop(){
              //-----------------------------------------------------------------------------
              //TEMP_FEUCHTE 
              delay(dht.getMinimumSamplingPeriod());
              

              My advice is to do this with a wait as well.

              void loop(){
              //-----------------------------------------------------------------------------
              //TEMP_FEUCHTE 
              wait(dht.getMinimumSamplingPeriod()); // Changed ByTheo
              

              That way you don't block incoming messages. Generally, if you want your sketch to wait use a wait.

              paqorP 1 Reply Last reply
              2
              • paqorP Offline
                paqorP Offline
                paqor
                wrote on last edited by paqor
                #7

                Okay, super, Thank you very much for your effort. I will correct it immediately

                1 Reply Last reply
                0
                • TheoLT TheoL

                  @paqor That's great. I looked at the Sketch you posted on your site and noticed you're still using a delay. Which as short as it may be can cause messages to be missed.

                  void loop(){
                  //-----------------------------------------------------------------------------
                  //TEMP_FEUCHTE 
                  delay(dht.getMinimumSamplingPeriod());
                  

                  My advice is to do this with a wait as well.

                  void loop(){
                  //-----------------------------------------------------------------------------
                  //TEMP_FEUCHTE 
                  wait(dht.getMinimumSamplingPeriod()); // Changed ByTheo
                  

                  That way you don't block incoming messages. Generally, if you want your sketch to wait use a wait.

                  paqorP Offline
                  paqorP Offline
                  paqor
                  wrote on last edited by
                  #8

                  @TheoL said:

                  @paqor That's great. I looked at the Sketch you posted on your site and noticed you're still using a delay. Which as short as it may be can cause messages to be missed.

                  void loop(){
                  //-----------------------------------------------------------------------------
                  //TEMP_FEUCHTE 
                  delay(dht.getMinimumSamplingPeriod());
                  

                  My advice is to do this with a wait as well.

                  void loop(){
                  //-----------------------------------------------------------------------------
                  //TEMP_FEUCHTE 
                  wait(dht.getMinimumSamplingPeriod()); // Changed ByTheo
                  

                  That way you don't block incoming messages. Generally, if you want your sketch to wait use a wait.

                  genial, works perfectly....

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  17

                  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