I have a problem with printing a float array. It says the call of the overloaded 'print(float[11], int)' is ambiguous.
here is the code:
#include <OLED320.h>
#include <string.h>
#include <ctype.h>
#include <print.h>
int rx1Pin = 19; // RX1 PIN
int tx1Pin = 18; // TX1 TX
int byteGPS=-1;
char linea[300] = "";
char arguments[13][11];
[glow]double float_arguments[13][11];[/glow]
char comandoGPR[7] = "$GPRMC";
int cont=0;
int bien=0;
int conta=0;
int indices[13];
OLED320 LED;
void setup() {
pinMode(rx1Pin, INPUT);
pinMode(tx1Pin, OUTPUT);
Serial1.begin(4800);
Serial2.begin(9600);
Serial.begin(19200);
for (int i=0;i<300;i++){ // Initialize a buffer for received data
linea[i]=' ';
}
Serial2.print(0x55,BYTE); //initialize led
delay(1000);
LED.LED_Clear(); //clear led
delay(100);
}
void loop() {
byteGPS=Serial1.read(); // Read a byte of the serial port
if (byteGPS == -1) { // See if the port is empty yet
delay(100);
} else {
linea[conta]=byteGPS; // If there is serial port data, it is put in the buffer
conta++;
if (byteGPS==13){ // If the received byte is = to 13, end of transmission
cont=0;
bien=0;
for (int i=1;i<7;i++){ // Verifies if the received command starts with $GPR
if (linea[i]==comandoGPR[i-1]){
bien++;
}
}
if(bien==6){ // If yes, continue and process data
for (int i=0;i<300;i++){
if (linea[i]==','){ // check for position of "," separator
indices[cont]=i;
cont++;
}
if (linea[i]=='*'){ // ... and the "*"
indices[12]=i;
cont++;
}
}
char* str = linea; //direct linea char array to str pointer array
char seperator = ',';
int count = 0, index = 0, sIndex = 0;
int theSize = 299;
arguments[index][count] = '\0'; // clear first argument before starting
while (theSize > sIndex + 1){
if (*str != seperator){
arguments[index][count] = *str; //store array sections into argument arrays
[glow]float_arguments[index][count] = (float) arguments[index][count];[/glow]
}
else {
arguments[index][count] = '\0';
}
*str++;
count++;
sIndex++;
if (*str == seperator){
*str++; // jump over the separator
count = 0;
index++;
arguments[index][count] = '\0'; // clear argument before starting
float_arguments[index][count] = '\0';
}
}
Serial.print("LAT: ");
[glow]Serial.print(float_arguments[3],2);[/glow]
}
conta=0; // Reset the buffer
for (int i=0;i<300;i++){ //
linea[i]=' ';
}
}
}
}
I thought print could now handle floating point. Possibly I was wrong in assuming it could handle an array of floating points.