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.6k 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.
  • P Offline
    P 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:"));
    }
    
    T 1 Reply Last reply
    0
    • P 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:"));
      }
      
      T Offline
      T Offline
      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
      • P Offline
        P Offline
        paqor
        wrote on last edited by
        #3

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

        T 1 Reply Last reply
        0
        • P paqor

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

          T Offline
          T Offline
          TheoL
          Contest Winner
          wrote on last edited by
          #4

          @paqor That it solve your problem?

          P 1 Reply Last reply
          0
          • T TheoL

            @paqor That it solve your problem?

            P Offline
            P 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/

            T 1 Reply Last reply
            1
            • P paqor

              @TheoL said:

              @paqor That it solve your problem?

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

              T Offline
              T Offline
              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.

              P 1 Reply Last reply
              2
              • P Offline
                P 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
                • T 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.

                  P Offline
                  P 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

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  16

                  Online

                  12.0k

                  Users

                  11.2k

                  Topics

                  113.4k

                  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