GPS module Delay

Hi, when i add a delay to my servo it adds a delay to my gps readings
How do i fix this, my baud rate is 9600 and i cant seem to change that for some reason.
the problem lies here as when i lowered the delay to delay(50); the gps was working faster:

 

Note: nevermind about it saying "INVALID" the problem still arrives even when readings arent invalid

Help us help you.

Look at File|Examples|02.Digital|BlinkWithoutDelay to use millis() for timing instead of delay().

Thats to be expected, delay() does stop\delay the program.

If you want help you will need to post the code you are using, we canot guess what the rest of the code is.

The problem is not the rest of the code it’s the delay from the servo and as long as I solve this or overwrite the gps it won’t work. How do I do solve this delay issue from the servo. The code which I have provided is where the issue is

You would use millis() for timing and get rid of delay().

You posted that lines of code that caused the not-functioning of the gps receiving
after you have added the delay(2000)

The solution is to

not

freeze the microcontroller completely.
executing a delay() stops ALL code-execution until delay-time is over
This is called blocking

Your code must be modified to be non-blocking

If you want to have a "delayed" moving of the servo in parallel to fast gps-receiving
this requires restructuring your code to be non-blocking and this is the reason why you should present the complete sketch.

The help can be much better taylored to your needs if you post your complete sketch.
If you prefer to keep your sketch a secret the more generalised advice has already been given
in this posting and in the other postings

best regards Stefan

Cool I found out that the problem was my brain is retarded :joy:

Are you going to tell us what the problem was ?

Was the problem in the code not posted ?

TinyGPS++ does have some well known (to me) issues reading a GPS .....................

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.