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. void receive not work with RelayActuator.ino ?

void receive not work with RelayActuator.ino ?

Scheduled Pinned Locked Moved Troubleshooting
5 Posts 3 Posters 78 Views 3 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.
  • Y Offline
    Y Offline
    yourry
    wrote on last edited by
    #1

    Hi all,
    I don't understand a problem,
    My receive function is not working in the sktech relayActuator.ino
    If I simply add the following code :

    ....
    void receive(const MyMessage &message)
    {
       Serial.print("--- Incoming Message ---");
      // We only expect one type of message from controller. But we better check anyway.
      if (message.getType()==V_STATUS) {
    ....
    

    I never have anything.
    But in the node logs I do receive the information:
    Relay OFF :

    345110 TSF:MSG:READ,0-180-162,s=180,c=3,t=6,pt=0,l=1,sg=0:0
    

    Relay ON:

    355655 TSF:MSG:READ,0-180-162,s=180,c=3,t=6,pt=0,l=1,sg=0:1
    

    For information I use a gateway+W5100 in MQTT.

    An idea why the receive function is not working here ?

    Thank you all

    skywatchS 1 Reply Last reply
    0
    • Y yourry

      Hi all,
      I don't understand a problem,
      My receive function is not working in the sktech relayActuator.ino
      If I simply add the following code :

      ....
      void receive(const MyMessage &message)
      {
         Serial.print("--- Incoming Message ---");
        // We only expect one type of message from controller. But we better check anyway.
        if (message.getType()==V_STATUS) {
      ....
      

      I never have anything.
      But in the node logs I do receive the information:
      Relay OFF :

      345110 TSF:MSG:READ,0-180-162,s=180,c=3,t=6,pt=0,l=1,sg=0:0
      

      Relay ON:

      355655 TSF:MSG:READ,0-180-162,s=180,c=3,t=6,pt=0,l=1,sg=0:1
      

      For information I use a gateway+W5100 in MQTT.

      An idea why the receive function is not working here ?

      Thank you all

      skywatchS Offline
      skywatchS Offline
      skywatch
      wrote on last edited by
      #2

      @yourry Don't use serial print inside the receive function.

      instead set a variable in receive and test for that in the main loop and then send serial from the main loop.

      This is probably all the problem is........ probably....... ;)

      YveauxY 1 Reply Last reply
      0
      • Y Offline
        Y Offline
        yourry
        wrote on last edited by
        #3

        Thanks for the answer, I keep the advice.
        Finally I looked for a while and the problem was with the MQTT publish syntax.
        It works perfectly, the difficulty is to find the right publish MQTT request.
        Thank you.

        1 Reply Last reply
        0
        • skywatchS skywatch

          @yourry Don't use serial print inside the receive function.

          instead set a variable in receive and test for that in the main loop and then send serial from the main loop.

          This is probably all the problem is........ probably....... ;)

          YveauxY Offline
          YveauxY Offline
          Yveaux
          Mod
          wrote on last edited by
          #4

          @skywatch said in void receive not work with RelayActuator.ino ?:

          Don't use serial print inside the receive function

          Why not? Receive doesn't run in interrupt context, so it should be safe to serial print from it...

          http://yveaux.blogspot.nl

          skywatchS 1 Reply Last reply
          0
          • YveauxY Yveaux

            @skywatch said in void receive not work with RelayActuator.ino ?:

            Don't use serial print inside the receive function

            Why not? Receive doesn't run in interrupt context, so it should be safe to serial print from it...

            skywatchS Offline
            skywatchS Offline
            skywatch
            wrote on last edited by
            #5

            @Yveaux I'm sure it's in the forum posts somewhere but I don't have time to look for it.

            Maybe you could do a list of what is and isn't possible in void receive to mitigate further confusions?

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


            21

            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