Help needed with an Autonomous rc car to travel between waypoints using GPS

Hey there. I’ve removed the pcb from an RC car and am using arduino and a GPS receiver to make it autonomous. I’ve only just started writing Arduino code for the first time, and I’ve modified a code I found online to fit my needs. however, theres some error in the code which is preventing me from compiling.

Im using the TinyGPS++ library and the error is :

" autonomous_car_project:58: error: no matching function for call to ‘TinyGPSPlus::courseTo(double&, double&)’ "

The entire code is below. the line which appears to be giving me trouble is highlighted in bold,
I’d appreciate any advice that points in the right direction.

#include “TinyGPS++.h”
#include <SoftwareSerial.h>

TinyGPSPlus gps;
SoftwareSerial ss(2,3);
int wpt = 0; // define variable wpt and assign a value of zero
double dest_latitude; // define floating point variable destination latitude
double dest_longitude; // define floating point variable destination longitude
int WPT_IN_RANGE= 12;

int pwmDrive = 11;
int pwmTurn = 10;
int driveDir = 13;
int leftRight = 12;
float dir;

/* DEFINE GPS WPTS HERE - Create more cases as needed */
void trackWpts() {
switch(wpt) {
case 0:
dest_latitude = 1.0; // switch…case statement used.switch statement compares the value of a variable to the values specified in case statements. When a case statement is found whose value matches that of the variable, the code in that case statement is run.
dest_longitude = 8.0;
case 1:
dest_latitude = 2.0;
dest_longitude = 3.0;
dest_latitude = 4.0;
dest_longitude = 5.0;
if (gps.distanceBetween(,gps.location.lng(),dest_latitude,dest_longitude) < WPT_IN_RANGE)
wpt++; // important statement - compares data from gprmc string with destination coordinates and switches the dest_lat and dest_lon

void setup() {

void loop() { // important loop - trackWpts switches between waypoints depending on distance from current position to waypoint
trackGPS(); // important statement in loop - trackGPS

void trackGPS() {
if (dest_latitude != 0 && dest_longitude != 0)


char c =;
if (gps.encode(c))
{if (gps.location.isUpdated()){

double dir=gps.courseTo(dest_latitude,dest_longitude)-gps.course();

if (dir < 0)
dir += 360; // increments dir by 360
if (dir > 180)
dir -= 360; // subtracts 360 from dir

if (dir < -75) // after incrementing or decrementing,conditions for turning left or right
else if (dir>75)
else stop();

void drive_forward(){
digitalWrite(driveDir, HIGH);
analogWrite(pwmDrive, 255);
void drive_backward(){
digitalWrite(driveDir, LOW);
analogWrite(pwmDrive, 255);

void right(){
digitalWrite(leftRight, HIGH);
analogWrite(pwmTurn, 255);
void left(){
digitalWrite(leftRight, LOW);
analogWrite(pwmTurn, 255);
void center(){
digitalWrite(leftRight, HIGH);
analogWrite(pwmTurn, 0);

TinyGPSPlus.h contains:

  static double courseTo(double lat1, double long1, double lat2, double long2);

So, why are you not passing it 4 values?

Thanks for your info,Paul.

Ah. I think I see what you mean. I may have misunderstood the courseTo statement.

If I enter courseTo(lat1,long1,lat2,long2), will it return the angle of a line drawn between points (lat1,long1) and (lat2,long2)? is that how it works?

That will be real useful, for a car.