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. Problem getting the code to run with MySensors library 2.0

Problem getting the code to run with MySensors library 2.0

Scheduled Pinned Locked Moved Troubleshooting
38 Posts 3 Posters 8.8k 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.
  • palande.vaibhavP palande.vaibhav

    @ayo
    Something weird is happening right now. I am now running MySensors version 2.0. The code you gave works with library version 2.0.

    I was just experimenting with the lines of the code to see which line makes difference and I found that #define MY_GATEWAY_SERIAL line makes difference.
    If I just add that line to my Blink code, it works with MySensors.h

    I don't know why this happens.

    //// Enable debug prints to serial monitor
    //#define MY_DEBUG 
    //
    //
    //// Enable and select radio type attached
    #define MY_RADIO_NRF24
    ////#define MY_RADIO_RFM69
    //
    //// Set LOW transmit power level as default, if you have an amplified NRF-module and
    //// power your radio separately with a good regulator you can turn up PA level. 
    //#define MY_RF24_PA_LEVEL RF24_PA_LOW
    //
    //// Enable serial gateway
    #define MY_GATEWAY_SERIAL
    //
    //// Define a lower baud rate for Arduino's running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
    //#if F_CPU == 8000000L
    //#define MY_BAUD_RATE 38400
    //#endif
    //
    //// Flash leds on rx/tx/err
    //#define MY_LEDS_BLINKING_FEATURE
    //// Set blinking period
    //#define MY_DEFAULT_LED_BLINK_PERIOD 300
    //
    //// Inverses the behavior of leds
    ////#define MY_WITH_LEDS_BLINKING_INVERSE
    //
    //// Enable inclusion mode
    //#define MY_INCLUSION_MODE_FEATURE
    //// Enable Inclusion mode button on gateway
    //#define MY_INCLUSION_BUTTON_FEATURE
    //
    //// Inverses behavior of inclusion button (if using external pullup)
    ////#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
    //
    //// Set inclusion mode duration (in seconds)
    //#define MY_INCLUSION_MODE_DURATION 60 
    //// Digital pin used for inclusion mode button
    //#define MY_INCLUSION_MODE_BUTTON_PIN  3 
    
    // Uncomment to override default HW configurations
    //#define MY_DEFAULT_ERR_LED_PIN 4  // Error led pin
    //#define MY_DEFAULT_RX_LED_PIN  6  // Receive led pin
    //#define MY_DEFAULT_TX_LED_PIN  5  // the PCB, on board LED
    
    #include <SPI.h>
    #include <MySensors.h>  
    
    void setup() { 
      // Setup locally attached sensors
      pinMode(8, OUTPUT);
    }
    
    void presentation() {
     // Present locally attached sensors 
    }
    
    void loop() { 
      // Send locally attached sensor data here 
       digitalWrite(8, HIGH);   // turn the LED on (HIGH is the voltage level)
      delay(1000);              // wait for a second
      digitalWrite(8, LOW);    // turn the LED off by making the voltage LOW
      delay(1000);              // wait for a second
    }
    

    This code works but only if I have #define MY_GATEWAY_SERIAL line included. Can you try this on your setup?

    In my code which was not working previously, If I just add #define MY_GATEWAY_SERIAL , it works.

    In your Blink code, if you just comment out the line #define MY_GATEWAY_SERIAL, it won't work. Can you try this?

    palande.vaibhavP Offline
    palande.vaibhavP Offline
    palande.vaibhav
    wrote on last edited by
    #12

    @mfalkvidd
    Any idea why this is happening?
    Cause I can't use MY_GATEWAY_SERIAL for a node. Right?

    mfalkviddM 1 Reply Last reply
    0
    • ayoA Offline
      ayoA Offline
      ayo
      wrote on last edited by
      #13

      Okay....so you are really having a strange problem here.
      Am using the Arduino version 1.6.8,
      Can you consider upgrading your arduino version maybe that could fix the CRC thing...

      palande.vaibhavP 2 Replies Last reply
      0
      • palande.vaibhavP palande.vaibhav

        @mfalkvidd
        Any idea why this is happening?
        Cause I can't use MY_GATEWAY_SERIAL for a node. Right?

        mfalkviddM Offline
        mfalkviddM Offline
        mfalkvidd
        Mod
        wrote on last edited by
        #14

        @palande.vaibhav said:

        Cause I can't use MY_GATEWAY_SERIAL for a node. Right?

        Yes you can. But I read that there is a bug in MySensors 2.0 that causes the presentation function to not run, so you'll need the latest code from the MySensors development branch on Github.

        palande.vaibhavP 4 Replies Last reply
        0
        • ayoA ayo

          Okay....so you are really having a strange problem here.
          Am using the Arduino version 1.6.8,
          Can you consider upgrading your arduino version maybe that could fix the CRC thing...

          palande.vaibhavP Offline
          palande.vaibhavP Offline
          palande.vaibhav
          wrote on last edited by
          #15

          @ayo

          1.6.8 is the older version. 1.6.12 is the latest version.

          And the CRC error is the known bug. So, if your IDE and MySensors work then don't change anything.

          1 Reply Last reply
          0
          • ayoA ayo

            Okay....so you are really having a strange problem here.
            Am using the Arduino version 1.6.8,
            Can you consider upgrading your arduino version maybe that could fix the CRC thing...

            palande.vaibhavP Offline
            palande.vaibhavP Offline
            palande.vaibhav
            wrote on last edited by palande.vaibhav
            #16

            @ayo
            did you try commenting #define MY_GATEWAY_SERIAL and running your Blink code?
            Can you please try that?

            ayoA 1 Reply Last reply
            0
            • mfalkviddM mfalkvidd

              @palande.vaibhav said:

              Cause I can't use MY_GATEWAY_SERIAL for a node. Right?

              Yes you can. But I read that there is a bug in MySensors 2.0 that causes the presentation function to not run, so you'll need the latest code from the MySensors development branch on Github.

              palande.vaibhavP Offline
              palande.vaibhavP Offline
              palande.vaibhav
              wrote on last edited by palande.vaibhav
              #17

              @mfalkvidd said:

              @palande.vaibhav said:

              Cause I can't use MY_GATEWAY_SERIAL for a node. Right?

              Yes you can. But I read that there is a bug in MySensors 2.0 that causes the presentation function to not run, so you'll need the latest code from the MySensors development branch on Github.

              But am I right that for MySensors version 2.0, we must have #define MY_GATEWAY_SERIAL line in order for the code to work? OR is it just me?

              And I don't even have anything in the presentation function. I think my problem is loop function not working if I don;t have #define MY_GATEWAY_SERIAL line in the code.

              1 Reply Last reply
              0
              • mfalkviddM mfalkvidd

                @palande.vaibhav said:

                Cause I can't use MY_GATEWAY_SERIAL for a node. Right?

                Yes you can. But I read that there is a bug in MySensors 2.0 that causes the presentation function to not run, so you'll need the latest code from the MySensors development branch on Github.

                palande.vaibhavP Offline
                palande.vaibhavP Offline
                palande.vaibhav
                wrote on last edited by
                #18

                @mfalkvidd said:

                @palande.vaibhav said:

                Cause I can't use MY_GATEWAY_SERIAL for a node. Right?

                Yes you can. But I read that there is a bug in MySensors 2.0 that causes the presentation function to not run, so you'll need the latest code from the MySensors development branch on Github.

                I tried with the library from Development branch on GitHub. It still doesn't work.
                I must have #define MY_GATEWAY_SERIAL line in the code for the code to work with MySensors.h.

                Library version:
                0_1474709782623_javaw_2016-09-24_02-35-41.png

                Code below doesn't work cause I have commented #define MY_GATEWAY_SERIAL: Just uncomment it and the same code works

                //MySensors
                // Enable debug prints
                //#define MY_DEBUG
                
                //// Enable and select radio type attached
                #define MY_RADIO_NRF24
                ////#define MY_RADIO_RFM69
                
                //#define MY_GATEWAY_SERIAL
                
                #include <SPI.h>
                #include <MySensors.h>
                
                unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds)
                const byte DIGITAL_INPUT_SENSOR = 3;   // The digital input you attached your motion sensor.  (Only 2 and 3 generates interrupt!)
                //#define CHILD_ID 1   // Id of the sensor child
                
                // Initialize motion message
                //MyMessage msg(1, V_LIGHT);
                
                void setup() { 
                  // Setup locally attached sensors
                  pinMode(8, OUTPUT);
                }
                
                void presentation() {
                 // Present locally attached sensors 
                }
                
                void loop() { 
                  // Send locally attached sensor data here 
                   digitalWrite(8, HIGH);   // turn the LED on (HIGH is the voltage level)
                  delay(1000);              // wait for a second
                  digitalWrite(8, LOW);    // turn the LED off by making the voltage LOW
                  delay(1000);              // wait for a second
                }
                
                1 Reply Last reply
                0
                • mfalkviddM mfalkvidd

                  @palande.vaibhav said:

                  Cause I can't use MY_GATEWAY_SERIAL for a node. Right?

                  Yes you can. But I read that there is a bug in MySensors 2.0 that causes the presentation function to not run, so you'll need the latest code from the MySensors development branch on Github.

                  palande.vaibhavP Offline
                  palande.vaibhavP Offline
                  palande.vaibhav
                  wrote on last edited by
                  #19

                  @mfalkvidd

                  I saw the post about the presentation function not working in 2.0. But that has been fixed in development version.

                  My problem is still there that code doesn't work at all. To which I think my loop function stops working if I don't have #define MY_GATEWAY_SERIAL line in the code.

                  mfalkviddM 1 Reply Last reply
                  0
                  • palande.vaibhavP palande.vaibhav

                    @mfalkvidd

                    I saw the post about the presentation function not working in 2.0. But that has been fixed in development version.

                    My problem is still there that code doesn't work at all. To which I think my loop function stops working if I don't have #define MY_GATEWAY_SERIAL line in the code.

                    mfalkviddM Offline
                    mfalkviddM Offline
                    mfalkvidd
                    Mod
                    wrote on last edited by
                    #20

                    @palande.vaibhav what does the debug output say?
                    You can also add a few Serial.println in the code to see where the execution stops.

                    palande.vaibhavP 1 Reply Last reply
                    0
                    • mfalkviddM mfalkvidd

                      @palande.vaibhav what does the debug output say?
                      You can also add a few Serial.println in the code to see where the execution stops.

                      palande.vaibhavP Offline
                      palande.vaibhavP Offline
                      palande.vaibhav
                      wrote on last edited by
                      #21

                      @mfalkvidd
                      Thanx for the suggestion. It's worse than I thought.

                      Here is the code:

                      
                      //MySensors
                      // Enable debug prints
                      //#define MY_DEBUG
                      
                      //// Enable and select radio type attached
                      #define MY_RADIO_NRF24
                      ////#define MY_RADIO_RFM69
                      
                      #define MY_GATEWAY_SERIAL
                      
                      #include <SPI.h>
                      #include <MySensors.h>
                      
                      // Initialize motion message
                      //MyMessage msg(1, V_LIGHT);
                      
                      void setup() { 
                        // Setup locally attached sensors
                        pinMode(8, OUTPUT);
                        Serial.println("Setup runs");
                      }
                      
                      void presentation() {
                       // Present locally attached sensors 
                       Serial.println("presentation runs");
                      }
                      
                      void loop() { 
                        // Send locally attached sensor data here 
                        Serial.println("loop runs");
                         digitalWrite(8, HIGH);   // turn the LED on (HIGH is the voltage level)
                        delay(1000);              // wait for a second
                        digitalWrite(8, LOW);    // turn the LED off by making the voltage LOW
                        delay(1000);              // wait for a second
                      }
                      

                      This is the output with #define MY_GATEWAY_SERIAL line.
                      0_1474716279452_javaw_2016-09-24_04-22-42.png

                      Without #define MY_GATEWAY_SERIAL, it doesn't show anything on the serial monitor.

                      palande.vaibhavP 1 Reply Last reply
                      0
                      • palande.vaibhavP palande.vaibhav

                        @ayo
                        did you try commenting #define MY_GATEWAY_SERIAL and running your Blink code?
                        Can you please try that?

                        ayoA Offline
                        ayoA Offline
                        ayo
                        wrote on last edited by
                        #22

                        I don't have access to my computer now I will try it when I have it.

                        @palande.vaibhav said:

                        @ayo
                        did you try commenting #define MY_GATEWAY_SERIAL and running your Blink code?
                        Can you please try that?

                        palande.vaibhavP 1 Reply Last reply
                        0
                        • palande.vaibhavP palande.vaibhav

                          @mfalkvidd
                          Thanx for the suggestion. It's worse than I thought.

                          Here is the code:

                          
                          //MySensors
                          // Enable debug prints
                          //#define MY_DEBUG
                          
                          //// Enable and select radio type attached
                          #define MY_RADIO_NRF24
                          ////#define MY_RADIO_RFM69
                          
                          #define MY_GATEWAY_SERIAL
                          
                          #include <SPI.h>
                          #include <MySensors.h>
                          
                          // Initialize motion message
                          //MyMessage msg(1, V_LIGHT);
                          
                          void setup() { 
                            // Setup locally attached sensors
                            pinMode(8, OUTPUT);
                            Serial.println("Setup runs");
                          }
                          
                          void presentation() {
                           // Present locally attached sensors 
                           Serial.println("presentation runs");
                          }
                          
                          void loop() { 
                            // Send locally attached sensor data here 
                            Serial.println("loop runs");
                             digitalWrite(8, HIGH);   // turn the LED on (HIGH is the voltage level)
                            delay(1000);              // wait for a second
                            digitalWrite(8, LOW);    // turn the LED off by making the voltage LOW
                            delay(1000);              // wait for a second
                          }
                          

                          This is the output with #define MY_GATEWAY_SERIAL line.
                          0_1474716279452_javaw_2016-09-24_04-22-42.png

                          Without #define MY_GATEWAY_SERIAL, it doesn't show anything on the serial monitor.

                          palande.vaibhavP Offline
                          palande.vaibhavP Offline
                          palande.vaibhav
                          wrote on last edited by palande.vaibhav
                          #23

                          @palande.vaibhav said:

                          @mfalkvidd
                          Thanx for the suggestion. It's worse than I thought.

                          Here is the code:

                          
                          //MySensors
                          // Enable debug prints
                          //#define MY_DEBUG
                          
                          //// Enable and select radio type attached
                          #define MY_RADIO_NRF24
                          ////#define MY_RADIO_RFM69
                          
                          #define MY_GATEWAY_SERIAL
                          
                          #include <SPI.h>
                          #include <MySensors.h>
                          
                          // Initialize motion message
                          //MyMessage msg(1, V_LIGHT);
                          
                          void setup() { 
                            // Setup locally attached sensors
                            pinMode(8, OUTPUT);
                            Serial.println("Setup runs");
                          }
                          
                          void presentation() {
                           // Present locally attached sensors 
                           Serial.println("presentation runs");
                          }
                          
                          void loop() { 
                            // Send locally attached sensor data here 
                            Serial.println("loop runs");
                             digitalWrite(8, HIGH);   // turn the LED on (HIGH is the voltage level)
                            delay(1000);              // wait for a second
                            digitalWrite(8, LOW);    // turn the LED off by making the voltage LOW
                            delay(1000);              // wait for a second
                          }
                          

                          This is the output with #define MY_GATEWAY_SERIAL line.
                          0_1474716279452_javaw_2016-09-24_04-22-42.png

                          Without #define MY_GATEWAY_SERIAL, it doesn't show anything on the serial monitor.

                          @mfalkvidd Any update on this?

                          mfalkviddM 1 Reply Last reply
                          0
                          • palande.vaibhavP palande.vaibhav

                            @palande.vaibhav said:

                            @mfalkvidd
                            Thanx for the suggestion. It's worse than I thought.

                            Here is the code:

                            
                            //MySensors
                            // Enable debug prints
                            //#define MY_DEBUG
                            
                            //// Enable and select radio type attached
                            #define MY_RADIO_NRF24
                            ////#define MY_RADIO_RFM69
                            
                            #define MY_GATEWAY_SERIAL
                            
                            #include <SPI.h>
                            #include <MySensors.h>
                            
                            // Initialize motion message
                            //MyMessage msg(1, V_LIGHT);
                            
                            void setup() { 
                              // Setup locally attached sensors
                              pinMode(8, OUTPUT);
                              Serial.println("Setup runs");
                            }
                            
                            void presentation() {
                             // Present locally attached sensors 
                             Serial.println("presentation runs");
                            }
                            
                            void loop() { 
                              // Send locally attached sensor data here 
                              Serial.println("loop runs");
                               digitalWrite(8, HIGH);   // turn the LED on (HIGH is the voltage level)
                              delay(1000);              // wait for a second
                              digitalWrite(8, LOW);    // turn the LED off by making the voltage LOW
                              delay(1000);              // wait for a second
                            }
                            

                            This is the output with #define MY_GATEWAY_SERIAL line.
                            0_1474716279452_javaw_2016-09-24_04-22-42.png

                            Without #define MY_GATEWAY_SERIAL, it doesn't show anything on the serial monitor.

                            @mfalkvidd Any update on this?

                            mfalkviddM Offline
                            mfalkviddM Offline
                            mfalkvidd
                            Mod
                            wrote on last edited by
                            #24

                            @palande.vaibhav no, I haven't got any ideas on what could be wrong. Sorry.

                            palande.vaibhavP 1 Reply Last reply
                            0
                            • ayoA ayo

                              I don't have access to my computer now I will try it when I have it.

                              @palande.vaibhav said:

                              @ayo
                              did you try commenting #define MY_GATEWAY_SERIAL and running your Blink code?
                              Can you please try that?

                              palande.vaibhavP Offline
                              palande.vaibhavP Offline
                              palande.vaibhav
                              wrote on last edited by
                              #25

                              @ayo Did you try running the code?

                              ayoA 1 Reply Last reply
                              0
                              • mfalkviddM mfalkvidd

                                @palande.vaibhav no, I haven't got any ideas on what could be wrong. Sorry.

                                palande.vaibhavP Offline
                                palande.vaibhavP Offline
                                palande.vaibhav
                                wrote on last edited by
                                #26

                                @mfalkvidd
                                Is it only me?
                                Can you please try this on your setup as time permits?
                                I have a manual install of the library 2.0
                                I want to use this for one of my projects and I am dead stuck.

                                1 Reply Last reply
                                0
                                • mfalkviddM mfalkvidd

                                  @palande.vaibhav said:

                                  Cause I can't use MY_GATEWAY_SERIAL for a node. Right?

                                  Yes you can. But I read that there is a bug in MySensors 2.0 that causes the presentation function to not run, so you'll need the latest code from the MySensors development branch on Github.

                                  palande.vaibhavP Offline
                                  palande.vaibhavP Offline
                                  palande.vaibhav
                                  wrote on last edited by palande.vaibhav
                                  #27

                                  @mfalkvidd
                                  I have to keep #define MY_GATEWAY_SERIAL line in the code for both gateway and sensor nodes.
                                  Now since I have #define MY_GATEWAY_SERIAL line in the code for both gateway and sensor node, both of them are initializing as gateways.
                                  And this causes them not to be able to communicate with each other.
                                  Please help
                                  0_1474801920068_javaw_2016-09-25_04-11-40.png

                                  1 Reply Last reply
                                  0
                                  • palande.vaibhavP palande.vaibhav

                                    @ayo Did you try running the code?

                                    ayoA Offline
                                    ayoA Offline
                                    ayo
                                    wrote on last edited by
                                    #28

                                    So I tried the whole code thing again as you have requested and I notice something weird happening to the device.
                                    This is the code below

                                    //// Enable debug prints to serial monitor
                                    //#define MY_DEBUG 
                                    //
                                    //
                                    //// Enable and select radio type attached
                                    #define MY_RADIO_NRF24
                                    ////#define MY_RADIO_RFM69
                                    //
                                    //// Set LOW transmit power level as default, if you have an amplified NRF-module and
                                    //// power your radio separately with a good regulator you can turn up PA level. 
                                    //#define MY_RF24_PA_LEVEL RF24_PA_LOW
                                    //
                                    //// Enable serial gateway
                                    //#define MY_GATEWAY_SERIAL
                                    
                                    #include <SPI.h>
                                    #include <MySensors.h>  
                                    
                                    void setup() { 
                                      // Setup locally attached sensors
                                      pinMode(8, OUTPUT);
                                    }
                                    
                                    void presentation() {
                                     // Present locally attached sensors 
                                     Serial.println("Presentation Runs");
                                    }
                                    
                                    void loop() { 
                                      // Send locally attached sensor data here 
                                       digitalWrite(8, HIGH);   // turn the LED on (HIGH is the voltage level)
                                      delay(1000);              // wait for a second
                                      digitalWrite(8, LOW);    // turn the LED off by making the voltage LOW
                                      delay(1000);              // wait for a second
                                      Serial.println("Loop is running");
                                    

                                    }

                                    After I commented out #define MY_GATEWAY_SERIAL nothing really happens on the serial monitor as you have said.
                                    No blinking nor display on the monitor.

                                    So I went back to the code and enable #define MY_DEBUG to see what was actually happening....

                                    THEN..I figured out what was happening
                                    I uploaded the new code with #define MY_Debug uncomment and #define MY_Gateway_Serial still commented out I got this one the serial monitor

                                    Starting sensor (RNNNA-, 2.0.0)
                                    TSM:INIT
                                    TSM:RADIO:OK
                                    TSM:FPAR
                                    TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                                    TSM:FPAR
                                    TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                                    TSM:FPAR
                                    TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                                    TSM:FPAR
                                    TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                                    !TSM:FPAR:FAIL
                                    !TSM:FAILURE
                                    TSM:PDT
                                    TSM:INIT
                                    TSM:RADIO:OK
                                    TSM:FPAR
                                    TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                                    TSM:FPAR
                                    TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                                    TSM:FPAR
                                    TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                                    

                                    From the result, the device is working as a node and trying to communicate with the parent/gateway and it enters an endless retry loop that keeps trying to communicate with the gateway. This is the reason i suppose nothing seems to be working because it is stuck trying to connect to the parent.
                                    The Addition of #define MY_GATEWAY_SERIAL makes it already a gateway/parent device and avoids that endless loop thing.

                                    @palande.vaibhav said:

                                    @ayo Did you try running the code?

                                    palande.vaibhavP 1 Reply Last reply
                                    1
                                    • ayoA Offline
                                      ayoA Offline
                                      ayo
                                      wrote on last edited by
                                      #29

                                      I think one way to go about making it work is to edit that element of the mysensor main code that makes it enter an infinite retry loop is to is to make it retry for about maybe 3 times if no connection still it should raise a flag and leaves the loop and continue into the main code.

                                      1 Reply Last reply
                                      0
                                      • ayoA ayo

                                        So I tried the whole code thing again as you have requested and I notice something weird happening to the device.
                                        This is the code below

                                        //// Enable debug prints to serial monitor
                                        //#define MY_DEBUG 
                                        //
                                        //
                                        //// Enable and select radio type attached
                                        #define MY_RADIO_NRF24
                                        ////#define MY_RADIO_RFM69
                                        //
                                        //// Set LOW transmit power level as default, if you have an amplified NRF-module and
                                        //// power your radio separately with a good regulator you can turn up PA level. 
                                        //#define MY_RF24_PA_LEVEL RF24_PA_LOW
                                        //
                                        //// Enable serial gateway
                                        //#define MY_GATEWAY_SERIAL
                                        
                                        #include <SPI.h>
                                        #include <MySensors.h>  
                                        
                                        void setup() { 
                                          // Setup locally attached sensors
                                          pinMode(8, OUTPUT);
                                        }
                                        
                                        void presentation() {
                                         // Present locally attached sensors 
                                         Serial.println("Presentation Runs");
                                        }
                                        
                                        void loop() { 
                                          // Send locally attached sensor data here 
                                           digitalWrite(8, HIGH);   // turn the LED on (HIGH is the voltage level)
                                          delay(1000);              // wait for a second
                                          digitalWrite(8, LOW);    // turn the LED off by making the voltage LOW
                                          delay(1000);              // wait for a second
                                          Serial.println("Loop is running");
                                        

                                        }

                                        After I commented out #define MY_GATEWAY_SERIAL nothing really happens on the serial monitor as you have said.
                                        No blinking nor display on the monitor.

                                        So I went back to the code and enable #define MY_DEBUG to see what was actually happening....

                                        THEN..I figured out what was happening
                                        I uploaded the new code with #define MY_Debug uncomment and #define MY_Gateway_Serial still commented out I got this one the serial monitor

                                        Starting sensor (RNNNA-, 2.0.0)
                                        TSM:INIT
                                        TSM:RADIO:OK
                                        TSM:FPAR
                                        TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                                        TSM:FPAR
                                        TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                                        TSM:FPAR
                                        TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                                        TSM:FPAR
                                        TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                                        !TSM:FPAR:FAIL
                                        !TSM:FAILURE
                                        TSM:PDT
                                        TSM:INIT
                                        TSM:RADIO:OK
                                        TSM:FPAR
                                        TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                                        TSM:FPAR
                                        TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                                        TSM:FPAR
                                        TSP:MSG:SEND 255-255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
                                        

                                        From the result, the device is working as a node and trying to communicate with the parent/gateway and it enters an endless retry loop that keeps trying to communicate with the gateway. This is the reason i suppose nothing seems to be working because it is stuck trying to connect to the parent.
                                        The Addition of #define MY_GATEWAY_SERIAL makes it already a gateway/parent device and avoids that endless loop thing.

                                        @palande.vaibhav said:

                                        @ayo Did you try running the code?

                                        palande.vaibhavP Offline
                                        palande.vaibhavP Offline
                                        palande.vaibhav
                                        wrote on last edited by
                                        #30

                                        @ayo
                                        But adding #define MY_GATEWAY_SERIAL to the code for the sensor node will make it a gateway. Right? Please check my last post where I posted the screenshots of this making both of them initialize as the gateway.

                                        And if both are gateways they won't communicate

                                        ayoA 1 Reply Last reply
                                        0
                                        • palande.vaibhavP palande.vaibhav

                                          @ayo
                                          But adding #define MY_GATEWAY_SERIAL to the code for the sensor node will make it a gateway. Right? Please check my last post where I posted the screenshots of this making both of them initialize as the gateway.

                                          And if both are gateways they won't communicate

                                          ayoA Offline
                                          ayoA Offline
                                          ayo
                                          wrote on last edited by
                                          #31

                                          Yes they won't communicate

                                          @palande.vaibhav said:

                                          @ayo
                                          But adding #define MY_GATEWAY_SERIAL to the code for the sensor node will make it a gateway. Right? Please check my last post where I posted the screenshots of this making both of them initialize as the gateway.

                                          And if both are gateways they won't communicate

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


                                          19

                                          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