Arduino GPS Shield acts as Arduino Shield via 1Sheeld

Buy 1Sheeld
Arduino GPS Shield acts as Arduino Shield via 1Sheeld

Buy 1Sheeld

Get the location of a moving object by getting the coordinates (longitude and latitude) easily from your phone
using two lines of code in your sketch and take a certain action.

This shield is one of the sensor shields. Sensor shields allows you to tap into your smartphone’s sensors and use in prototyping with Arduino, you can get information from the surrounding environment and use
it to trigger a certain action.Learn more from the sensor shields tutorial.

GPS Library allows Arduino board to get location data from the smartphone’s gps and takes certain actions within these data.

Adding #define CUSTOM_SETTINGS along with #define INCLUDE_GPS_SENSOR_SHIELD is a key that will let you unlock the GPS sensor shield only amongst all shields and prevent 1Sheeld library from eating your memory specially for UNO board.

Note

For Android M(6) or greater, there are permissions to be granted before using the Data Logger shield, please make sure to grant the permissions or else it may affect the application’s performance.

float getLatitude(void)

Returns current latitude according to the smartphone’s current place.

 

SYNTAX
GPS.getLatitude();

 

RETURNS
Returns a float holding latitude value in degrees.

 

PARAMETERS
None.

 

USAGE
float latitude = GPS.getLatitude();

 

float getLongitude(void)

Returns current longitude according to the smartphone’s current place.

 

SYNTAX
GPS.getLongitude();

 

RETURNS
Returns a float holding longitude value in degrees.

 

PARAMETERS
None.

 

USAGE
float longitude = GPS.getLongitude();

 

bool isInRange(float,float,float)

Checks if your smartphone is in range giving the fixed latitude and longitude and range to be compared in meters.

 

SYNTAX
GPS.isInRange();

 

RETURNS
Returns a Yes “1” or No “0”.

 

PARAMETERS
– 1st Parameter takes a float holding the fixed value of latitude.
– 2nd Parameter takes a float holding the fixed value of longitude.
– 3rd Parameter takes a float holding the range to be checked on in meters.

 

USAGE
if(GPS.isInRange(30.0831008,31.3242943,100))
{
    pinMode(pin13,OUTPUT);
    digitalWrite(pin13,HIGH);
}
else
{
    digitalWrite(pin13,LOW);
}

 

float getDistance(float,float)

Returns the distance between the given fixed latitude and longitude and the smartphone’s current place.

 

SYNTAX
GPS.getDistance(fixedLatitude,fixedLongitude);

 

RETURNS
Returns a float holding distance in meters.

 

PARAMETERS
– 1st Parameter takes a float holding the fixed value of latitude.
– 2nd Parameter takes a float holding the fixed value of longitude.

 

USAGE
float distance = GPS.getDistance(30.0831008,31.3242943);

 

float radian(float)

Helper function to convert latitude or longitude values to radians.

 

SYNTAX
GPS.radian(latitude/longitude);

 

RETURNS
Returns a float holding value in radians.

 

PARAMETERS
Takes a float holding the fixed value of latitude/longitude.

 

USAGE
float radian =GPS.radian(30.0831008);

 

void setOnValueChange(void(*userFunction)(float,float))

Sets a certain individual function written by the user in the sketch to be called and runs its functionality once a latitude or longitude change occurs.

 

SYNTAX
GPS.setOnValueChange(&userFunctionName);

 

RETURNS
None.

 

PARAMETERS
&userFunctionName: takes the physical address of the userFunction in the memory and jump to it once called to execute it’s functionality.

 

USAGE
GPS.setOnValueChange(&myFunction);
/* myFunction exists under the loop function. */
/* This function will be invoked each time a new value comes to arduino from the  
     smartphones gps sensor. */
void myFunction (float latitude , float longitude)
{
    /* Turn on the led once any button is pressed*/
    if(upButton)
    {
    
        pinMode(pin13 ,OUTPUT);
        digitalWrite(pin13 ,HIGH);
    }
}