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. My Project
  3. Correct Usage of MY_DEBUGDEVICE

Correct Usage of MY_DEBUGDEVICE

Scheduled Pinned Locked Moved My Project
6 Posts 3 Posters 86 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.
  • T Offline
    T Offline
    TheOtherMatt
    wrote on last edited by
    #1

    Maybe I am missing the obvious, but I do not get along with the use of MY_DEBUGDEVICE.
    My Arduino Sketch on a Pro Mini looks as follows:

    #define MY_DEBUG 
    #define MY_DISABLED_SERIAL    // I want to use the hardware serial myself
    #define MY_SPLASH_SCREEN_DISABLED   // as per some forum post 
    // #define MY_BAUD_RATE 75   // unclear to what device it refers, assuming HW serial
    
    // Setting up SoftwareSerial. 
    // For Pro Mini (AtMega 328P) all pins are allowed
    // TX pin is onboard LED, so I should see it flicker on transmit.
    int Soft_TX = 3;      // Port D3
    int Soft_RX = 5;      // Port D5, only needed for init
    #include <SoftwareSerial.h> 
    SoftwareSerial mySerial(Soft_RX, Soft_TX);
    
    // Switch debug output for MySensors
    #define MY_DEBUGDEVICE mySerial;
    #include <MySensors.h>
    
    void setup()  
    {  
    }
    
    void loop() 
    {
      mySerial.begin(75);
      mySerial.print("always visible"); 
    
      #ifdef MY_DEBUG
       mySerial.print("only visible with DEBUG flag");
      #endif
    
     }
    

    Result: The onboard LED on Port D3 lights constantly.
    If I connect a serial-to-USB converter and watch the output on a terminal, I see no text.

    If I remove all references to MySensors, i.e. only initialize SoftSerial, the LED is flickering as expected.
    So far I conclude I am using the re-definition of MY_DISABLED_SERIAL and MY_DEBUGDEVICE incorrectly.

    skywatchS 1 Reply Last reply
    0
    • electrikE Offline
      electrikE Offline
      electrik
      wrote on last edited by
      #2

      MY_DISABLED_SERIAL wil output nothing on the serial, no matter software or hardware serial. So in your case you don't need to define it.
      And try removing the semicolon after

      #define MY_DEBUGDEVICE mySerial;
      
      1 Reply Last reply
      1
      • T Offline
        T Offline
        TheOtherMatt
        wrote on last edited by
        #3

        Thank you! Now I can see my debug message on SoftSerial.

        1 Reply Last reply
        1
        • T TheOtherMatt

          Maybe I am missing the obvious, but I do not get along with the use of MY_DEBUGDEVICE.
          My Arduino Sketch on a Pro Mini looks as follows:

          #define MY_DEBUG 
          #define MY_DISABLED_SERIAL    // I want to use the hardware serial myself
          #define MY_SPLASH_SCREEN_DISABLED   // as per some forum post 
          // #define MY_BAUD_RATE 75   // unclear to what device it refers, assuming HW serial
          
          // Setting up SoftwareSerial. 
          // For Pro Mini (AtMega 328P) all pins are allowed
          // TX pin is onboard LED, so I should see it flicker on transmit.
          int Soft_TX = 3;      // Port D3
          int Soft_RX = 5;      // Port D5, only needed for init
          #include <SoftwareSerial.h> 
          SoftwareSerial mySerial(Soft_RX, Soft_TX);
          
          // Switch debug output for MySensors
          #define MY_DEBUGDEVICE mySerial;
          #include <MySensors.h>
          
          void setup()  
          {  
          }
          
          void loop() 
          {
            mySerial.begin(75);
            mySerial.print("always visible"); 
          
            #ifdef MY_DEBUG
             mySerial.print("only visible with DEBUG flag");
            #endif
          
           }
          

          Result: The onboard LED on Port D3 lights constantly.
          If I connect a serial-to-USB converter and watch the output on a terminal, I see no text.

          If I remove all references to MySensors, i.e. only initialize SoftSerial, the LED is flickering as expected.
          So far I conclude I am using the re-definition of MY_DISABLED_SERIAL and MY_DEBUGDEVICE incorrectly.

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

          @TheOtherMatt All pro minis I have seen have led on D13 and not D3 (unless you have cut tracks and re-routed it).

          If the D13 led is on constantly it is probably because you have not given mysensors any clue about radios attached and it is trying to initialise a non-existant radio module.

          Add to your code the radio setup you will use and connect your radio to it correctly as I suspect it is just looping trying to get a response.

          Also, I always put a wait(100); after every send to allow the power line to settle and the capacitor to recharge.

          T 1 Reply Last reply
          0
          • T Offline
            T Offline
            TheOtherMatt
            wrote on last edited by
            #5

            Yes, I had to state a radio definition too. I now see my soft serial prints as well as the debug transport layer messages to the (not yet connected) radio. All is as expected now. Now I can hook up the hardware serial to my periphery and build my node :-)

            1 Reply Last reply
            0
            • skywatchS skywatch

              @TheOtherMatt All pro minis I have seen have led on D13 and not D3 (unless you have cut tracks and re-routed it).

              If the D13 led is on constantly it is probably because you have not given mysensors any clue about radios attached and it is trying to initialise a non-existant radio module.

              Add to your code the radio setup you will use and connect your radio to it correctly as I suspect it is just looping trying to get a response.

              Also, I always put a wait(100); after every send to allow the power line to settle and the capacitor to recharge.

              T Offline
              T Offline
              TheOtherMatt
              wrote on last edited by TheOtherMatt
              #6

              @skywatch Ah, and you are right about the LED. I re-designed the circuitry a while ago to accommodate a RFM69 on the PCB back side, and meanwhile forgot the fact that my LED is now connected to Atmega328‘s port D3 now. For the serial function test it does not make a difference, however.

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


              22

              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