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] No Serial prints for loop(), using MySensors 2.1.1

[SOLVED] No Serial prints for loop(), using MySensors 2.1.1

Scheduled Pinned Locked Moved Troubleshooting
4 Posts 2 Posters 1.7k 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.
  • H Offline
    H Offline
    HenryWhite
    wrote on last edited by HenryWhite
    #1

    Hi,

    I'm getting all the debug messages if I define #MY_DEBUG, but none of my Serial prints in the loop functions are shown.
    However, Serial prints in the receive function are shown.

    Example sketch:

    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    //#define MY_RADIO_RFM69
    
    // Enable repeater functionality for this node
    #define MY_REPEATER_FEATURE
    
    #define MY_NODE_ID 20
    
    #include <MySensors.h>
    
    #define RELAY_1  5  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
    #define NUMBER_OF_RELAYS 1 // Total number of attached relays
    #define RELAY_ON 1  // GPIO value to write to turn on attached relay
    #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
    
    
    void before()
    {
    	for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
    		// Then set relay pins in output mode
    		pinMode(pin, OUTPUT);
    		// Set relay to last known state (using eeprom storage)
    		digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);
    	}
    }
    
    void setup()
    {
    
    }
    
    void presentation()
    {
    	// Send the sketch version information to the gateway and Controller
    	sendSketchInfo("Relay", "1.0");
    
    	for (int sensor=1, pin=RELAY_1; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
    		// Register all sensors to gw (they will be created as child devices)
    		present(sensor, S_BINARY);
    	}
    }
    
    
    void loop()
    {
      Serial.println("This doesn't print :(");
      delay(1000);
      
    }
    
    void receive(const MyMessage &message)
    {
    	// We only expect one type of message from controller. But we better check anyway.
    	if (message.type==V_STATUS) {
    		Serial.println("This does print!");
    	}
    }
    

    It would be really nice if someone could help me with this problem.

    1 Reply Last reply
    0
    • H Offline
      H Offline
      HenryWhite
      wrote on last edited by HenryWhite
      #2

      I found the problem, but not the solution.

      First, I added #define MY_TRANSPORT_WAIT_READY_MS 1 to the sketch.
      Now the loop()-Function gets executed.
      Problem: My node isn't registered by the gateway:

      New Motion State: 1
      80949 !MCO:SND:NODE NOT REG
      81582 TSF:MSG:READ,0-0-20,s=255,c=3,t=8,pt=1,l=1,sg=0:0
      81588 TSF:MSG:FPAR OK,ID=0,D=1
      82950 TSM:FPAR:OK
      82952 TSM:ID
      82952 TSM:ID:OK
      82954 TSM:UPL
      82958 TSF:MSG:SEND,20-20-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
      84967 TSM:UPL
      84969 TSF:MSG:SEND,20-20-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1 
      

      :arrow_right: My Gateway is running on an old version of MySensors, I believe it's 1.5.4
      Do I have to update the gateway? I thought I could leave it at 1.5.4.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        korttoma
        Hero Member
        wrote on last edited by
        #3

        I think that 1.5.x GW does not work with 2.x nodes but 2.x GW works with 1.5.x nodes.
        Please update your GW ;)

        • Tomas
        H 1 Reply Last reply
        1
        • K korttoma

          I think that 1.5.x GW does not work with 2.x nodes but 2.x GW works with 1.5.x nodes.
          Please update your GW ;)

          H Offline
          H Offline
          HenryWhite
          wrote on last edited by
          #4

          @korttoma thanks! It works now. :)
          Could have saved me hours of troubleshooting if I knew that prior :/

          1 Reply Last reply
          1

          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


          21

          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