Arduino_MKRGPS - altitude()

Read the altitude of the GPS.

Syntax

GPS.altitude()

Parameters

None.

Returns

GPS altitude in meters.

Example

// Check if there is new GPS data available
if (GPS.available()) {
    // Read GPS data
    float altitude = GPS.altitude();

    // ...

    // Print GPS data
    Serial.print("Altitude: ");
    Serial.print(altitude);
    Serial.println("m");
}

See also