Code in void loop() did not execute

I’m starting taking arduino lessons and I’m actively helping my friends code to improve my skills. However, in this particular code, I am a bit confused because when I uploaded it only output a part of code in void setup() and void loop() instead of all of them. For example, the output for code below was not executed in serial monitor. Can someone point out the mistakes in my code and how to fix it please? I really appreciate and thank you so much for helping me learning <3

// Get a fix on location, try every 2s
  while (!fona.getGPS(&latitude, &longitude, &speed_kph, &heading, &altitude, &year, &month, &day, &hour, &minute, &second)) {
    Serial.println(F("Failed to get GPS location, retrying..."));
    delay(2000); // Retry every 2s
  }

Serial.println(F("---------------------"));
  Serial.print(F("Latitude: ")); Serial.println(latitude, 6);
  Serial.print(F("Longitude: ")); Serial.println(longitude, 6);
  Serial.print(F("Speed: ")); Serial.println(speed_kph);
  Serial.print(F("Heading: ")); Serial.println(heading);
  Serial.print(F("Altitude: ")); Serial.println(altitude);

Gabung.ino (25.6 KB)

The mistake is likely in the code you did not post!

Paul

I can't see a setup() or a loop() so I have no idea where that snippet fits in or how it might get used or missed. Complete programs are useful. Tiny fragments of code are not.

Steve

The OP did attach the code but it's too long to make sense without knowing what it should do. So what did OP want to see and what did you end up seeing? Maybe you care to explain in a reply?

You are probably better , if learning , to use the basic examples provided with the board/library and develop onwards from there with your own code.

Downloading and using others code is often frustrating*, when it doesn’t work , and not IMO a great way to learn coding .

  • it nay never have worked , the varied styles used can make it difficult to interpret .
    It might be worth reading up on de bugging techniques to help you .