GPS and IMU

Hello,

I want to use GPS and IMU modules with Arduino. I found a program which shows GPS valuesI use the following programs for GPS and main. But I could not take GPS values they always show 0. When use the basic program for the GPS, I take all parameters for GPS.

Can anyone help me ?

GPS_Tiny.ino (1.38 KB)

Waveshare_Deneme3.ino (5.98 KB)

  gps.encode(altserial.read());

The encode method returns a value. Why do you ignore it?

  while (!intFlag);

It is absolutely pointless to use interrupts, and then bury your head in the sand until the interrupt happens.

Thanks for your answer, but I could not understand exactly where I will put this command and which interrupt will I use ?

I checked the steps in following program and I saw that the program goes never step "2" ? why? :sleeping:

void gprmcOku()
{
Serial.println("1");   
  while(altserial.available()) 
  {
    Serial.println("2");
    gps.encode(altserial.read());
  }
    Serial.println("3");
    if(gps.location.isUpdated())
  {
    Serial.println("4");
    boylam = (gps.location.lng()) * 1000000;
    enlem = (gps.location.lat()) * 1000000;
      
  }
}

I would guess that the while here is never true:

Serial.println("1");
while(altserial.available())
{
}

so the action in the braces { } never execute.
Does the program print 1 and then go on to print 3?

Yes,
Program goes to step 3 after step 1.

Then whatever is connected to the AltSoftSerial pins is not connected correctly (wires crossed?) or is not powered or is not working.

which interrupt will I use ?

None. Why are you using interrupts, anyway? If you are going to just sit around and do nothing anyway, there is no reason to use interrupts. They are so that you CAN do other things, and not worry about missing a critical event.

Is altSerial.available() command an interrupt ? If yes, the software must go step2 but never goes to step2 , why?

Is altSerial.available() command an interrupt ?

No. It simply returns the number of characters in the incoming serial buffer.