MakerGram Logo

    MakerGram

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags
    • Users
    • Groups

    GPS + RF433 Not working together.

    Arduino
    3
    14
    1250
    Loading More Posts
    • 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.
    • rafitc99
      rafitc99 @salmanfaris last edited by

      @salmanfaris said in GPS + RF433 Not working together.:

      @rafitc99 said in GPS + RF433 Not working together.:

      library it's not waiting for Serial.available()

      did you try manual waiting? Instead of delay, you can use mills, so the background works will keep run.

      Let me try.

      rafitc99 1 Reply Last reply Reply Quote 1
      • rafitc99
        rafitc99 @rafitc99 last edited by

        @salmanfaris

        did you try manual waiting? Instead of delay, you can use mills, so the background works will keep run.

        Not working. Same problem.

        rafitc99 1 Reply Last reply Reply Quote 1
        • rafitc99
          rafitc99 @rafitc99 last edited by rafitc99

          @salmanfaris It's worked. 😇 Thank you @salmanfaris for your replies.

          Actually a small change in void loop is the solution

          void loop(){
              // Set buffer to size of expected message
              uint8_t buf[1];
              uint8_t buflen = sizeof(buf);
              // Check if received packet is correct size
            if (vw_get_message(message, &messageLength)) // non-blocking
            {
              Serial.print("Potentiometer: ");
                //Serial.print(message[i]);
                received_number = message[i];
              Serial.println(received_number);
          
              }
              
                if(received_number == 1){
                  getGpsData();  
                }
          }
          

          Used two simple if instead of Nested IF. idk what is the problem of first code. Also if I add any delay() inside void getGpsData() function, showing same problem.

          1 Reply Last reply Reply Quote 1
          • manthan555
            manthan555 @rafitc99 last edited by

            @rafitc99
            Remember one thing...
            For all you guys who work with software serial or hardware serial...

            First and most important thing is while working with software serial... In loop remember that softwareSerial never generate interrupt while it receives any data as you can say triggers if condition... When it's turn comes it checks otherwise if condition will bypass so your target or trigger cannot be achieved....

            For hardware serial always prefer to use interrupt method to get data for each character you can receive simultaneously loops runs any function or not... It's surely you can get all the data from serial... Although mcu runs any kinds of task it leaves and goes on serial interrupt...

            So it's my experience and suggestions to all you guys to remeber this thing...

            If you all.come across the situations that there is no provision to use hardware serial and you need to use softwareSerial then remember that your loop must have intelligence to get the data from softwareserial by if condition which does not effect other functions in loop.. kindly for RF functions which must be used in loop that can't be avoided by any delay functionality... So Millis can be helpful or timer interrupt can help you...

            Thanks...

            1 Reply Last reply Reply Quote 3
            • First post
              Last post

            Recent Posts

            • @codelery Awesome. That's great news. Kudos to @rafitc99 . 🙌

              @codelery Please keep us updated about your project, looking forward to seeing it in action 🤩

              • read more
            • C

              @rafitc99 I changed the buffer and that solved the problem. Thanks a lot for coming to my rescue.

              • read more
            • C

              @salmanfaris I did change the buffer size and everything is working perfectly. Thanks coming to my rescue.

              • read more
            • @codelery said in Help needed: Arduino Wireless Notice Board project:

              I am using the hardware serial (pin 0 and 1 on Arduino Uno)

              As @rafitc99 mentioned, you need to expand the Serila buffer, in the hardware serial also the Arduino board package implements a 64-byte ring buffer for send and receive on the hardware serial messages. So you need to change that to 256 as per your message length.

              • read more
            • C

              @rafitc99 The thing is that I am not using the SoftwareSerial library in receiving the message from the first microcontroller. I am using the hardware serial (pin 0 and 1 on Arduino Uno)

              • read more
            By MakerGram | A XiStart Initiative | Built with ♥ NodeBB
            Copyright © 2023 MakerGram, All rights reserved.
            Privacy Policy | Terms & Conditions | Disclaimer | Code of Conduct