Phantom Code : Too few arguments for my GPS and WiFi Functions

Hi folks, so I have an arduino uno that has a CC3000 Wifi Shield and a CN-06 Ublox Neo 6M GPS hooked up to it. I've managed to run some code to get the Wifi Sheild to behave properly by itself and I've also written some code that gets the GPS to function and spit out lat's long's etc.

My dilemma is when I try and combine the two codes and then Arduino gets all pissy with me. Here's the code:
Please excuse my messy commenting etc.

//Libraries
#include <SPI.h>
#include <string.h>
#include <Adafruit_CC3000.h>
#include <Adafruit_CC3000_Server.h>
#include <ccspi.h>
#include "utility/debug.h"
#include <stdlib.h>
#include <SoftwareSerial.h>

//Set Harware Configuration Pins etc.
SoftwareSerial gps_comms(6, 7);     //Two pins that were free and not used for SPI commms
#define ADAFRUIT_CC3000_IRQ    3    // Must be an interrupt pin!
#define ADAFRUIT_CC3000_VBAT   5    
#define ADAFRUIT_CC3000_CS     10
Adafruit_CC3000 cc3000 = Adafruit_CC3000(ADAFRUIT_CC3000_CS, ADAFRUIT_CC3000_IRQ, ADAFRUIT_CC3000_VBAT, SPI_CLOCK_DIVIDER);

//Define GPS Parameters
const int data_size = 80;
char data[data_size];
int latitude = 0;
int longitude = 0;
char length = 0;
//char field[20];

//Define wifi parameters
#define WLAN_SSID              "MagelliumLtd"
#define WLAN_PASS              "blablabla"
#define WLAN_SECURITY          WLAN_SEC_WPA2

//Xively Parameters
#define WEBSITE "api.xively.com"
#define API_key "thekey"
#define feedID "lol"

uint32_t ip = 0;

void setup() {
  //Initialise GPS
  Serial.begin(9600);
  gps_comms.begin(9600);
  
  //Initialize CC3000
  Serial.begin(115200);
  
  Serial.println(F("\nInitializing..."));
  if (!cc3000.begin()) {
    Serial.println(F("Couldn't begin()! Sort your life out!!!"));
    while(1);
  }
}

void loop(void) {
  static int i = 0;
  if (gps_comms.available()) {
    char ch = gps_comms.read();
    if (ch != '\n' && i < data_size) {
      data[i] = ch;
      i++;
    }
    else {
      data[i] = '\0';
      i = 0;
      displayGPS();
      getField();
    }
  }
  
  //Connect to WiFi network
  cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY);
  Serial.println(F("Connected!"));
  
  /*Wait for DHCP to complete */
  Serial.println(F("Request DHCP"));
  while (!cc3000.checkDHCP()) {
    delay(100);
  }
  
  //Get the website IP and Print it
  ip = 0;
  Serial.print(WEBSITE); Serial.print(F(" -> "));
  while (ip == 0) {
    if (!cc3000.getHostByName(WEBSITE, &ip)) {
      Serial.println(F("Couldn't resolve!"));
    }
    delay(500);
  }
  cc3000.printIPdotsRev(ip);
    
  //Get data & transform to integers
  float lat = latitude;
  float lon = longitude;
  
  //JSON data
  String data = "";
  data = data + "\n" + "{\"version\":\"1.0.0\",\"datastreams\" : [ "
  + "{\"id\" : \"Latitude\",\"current_value\" : \"" + String(latitude) + "\"},"
  + "{\"id\" : \"Humidity\",\"current_value\" : \"" + String(longitude) + "\"}]}";
  
  //Get Length
  length = data.length();
  Serial.print("Data Length");
  Serial.println(length);
  Serial.println();
  
  //Print request for debug purposes
  Serial.print("PUT /v2/feed/");
  Serial.print(feedID);
  Serial.println(".json HTTP/1.0");
  Serial.print("X-ApiKey: ");
  Serial.print(API_key);
  Serial.print(" Content-Length: ");
  Serial.println("Connection: close");
  Serial.println();
  Serial.print(data);
  Serial.println();
  
  //Send Request
  Adafruit_CC3000_Client client = cc3000.connectTCP(ip, 80);
  if (client.connected()) {
    Serial.println("Connected!");
    client.println("PUT /v2/feeds/" + String(feedID) + ".json HTTP/1.0");
    client.println("Host: api.xively.com");
    client.println("X-ApiKey: " + String(API_key));
    client.println("Content-Length: " + String(length));
    client.print("Connection: close");
    client.println();
    client.print(data);
    client.println();
  } else {
    Serial.println(F("You Failed"));
    return;
  }
  
  Serial.println(F("--------------------------------------"));
  while (client.connected()) {
    while (client.available()) {
      char c = client.read();
      Serial.print(c);
    }
  }
  client.close();
  Serial.println(F("\n\nDisconnecting"));
  cc3000.disconnect();
  
  //Wait 60 seconds until next update
  delay(60000);
}

void displayGPS() {
  char field[20];
  getField(field, 0);
  if (strcmp(field, "$GPRMC") == 0) {
    //Serial.println("TIMESTAMP      VALID      LATITUDE  N/S      LONGITUDE  E/W      SPEED      TRUE COURSE      DATESTAMP      VARIATION      E/W      CHECKSUM")
    //Serial.println(" HHMMSS         A/V         DMS                 DMS               KTS            º            DDMMYY            º                           ")
    //Serial.println("--------------------------------------------------------------------------------------------------------------------------------------------")    
    Serial.println("||----------------------------||");
    Serial.print("||  TIMESTAMP: ");
    getField(field, 1);
    Serial.println(field);
    Serial.print("||  VALID: ");
    getField(field, 2);
    Serial.println(field);
    Serial.print("||  LAT: ");
    getField(field, 3);    // number
    Serial.print(field);
    getField(field, 4);
    Serial.println(field);
    Serial.print("||  LONG: ");
    getField(field, 5);
    Serial.print(field);
    getField(field, 6);
    Serial.println(field);
    Serial.print("||  SPEED: ");
    getField(field, 7);
    Serial.println(field);
    Serial.print("||  TMG: ");
    getField(field, 8);
    Serial.println(field);
    Serial.print("||  DATESTAMP: ");
    getField(field, 9);
    Serial.println(field);
    Serial.print("||  VARIATION: ");
    getField(field, 10);
    Serial.print(field);
    getField(field, 11);
    Serial.println(field);
    //Serial.print("    ||  CHEKSUM: ");
    //getField(field, 12);
    //Serial.println(field);
    // Serial.print("   
    //getField(field, 4);    // N/S
    //Serial.print(field);
    
    //Serial.print(" Long: ");
    //getField(field, 5);    // number
    //Serial.print(field);
    //getField(field, 6);    // E/W
    //Serial.println(field);
  }
}

void getField(char* buffer, int index) {
  //char field[20];
  int data_pos = 0;
  int field_pos = 0;
  int comma = 0;
  while (data_pos < data_size) {
    if (data[data_pos] == ',') {
      comma ++;
      data_pos ++;
    }
    if (comma == index) {
      buffer[field_pos] = data[data_pos];
      field_pos ++;
    }
    data_pos ++;
  }
  buffer[field_pos] = '\0';
}

When I try and compile this I get an error message saying "too few arguments to function 'void getField(char*, int)' on line 16?
There's no code on line 16 :cry:

Can anyone shed some light on my predicament?

      i = 0;
      displayGPS();
      getField();

Get field has to few param's simples

Mark

Cheers, turns out there was no reason for that line to be there. Everything seems to compile fine once I took it out :slight_smile: