I am having a problem passing a character to a function. It gives the invalid conversion from char to char* error. I am using the code from the parallax gps arduino tutorial at: Arduino Playground - GPS
This is the code:
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++;
Serial.print(byteGPS, BYTE);
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 the data
for (int i=0;i<300;i++){
if (linea[i]==','){ // check for the position of the "," separator
indices[cont]=i;
cont++;
}
if (linea[i]=='*'){ // ... and the "*"
indices[12]=i;
cont++;
}
}
for(int j=8; j<14; j++){
LED.LED_PrintString(linea[j], 0x00, 0x1d, 0x00, 0x02, 0, 0x00, 0x00, 0x01, 0x02); //print time value
}
}
conta=0; // Reset the buffer
for (int i=0;i<300;i++){ //
linea[i]=' ';
}
}
}
delay(1000);
}
this is the function i am passing it to:
void OLED320::LED_PrintString(char* str, char xa, char xb, char ya, char yb, char font, char color1, char color2, char width_, char height_)
{
delay(10);
int i = 0;
Serial.print(0x53,BYTE); //print string cmd
Serial.print(xa,BYTE); //xa coord
Serial.print(xb,BYTE); //xb coord
Serial.print(ya,BYTE); //y1 coord
Serial.print(yb,BYTE); //y2 coord
Serial.print(font,BYTE); //font
Serial.print(color1,BYTE); //color
Serial.print(color2,BYTE); //color
Serial.print(width_,BYTE); //width
Serial.print(height_,BYTE); //height
while(str[i]!='\0')
{
Serial.print(str[i],BYTE);
i++;
}
Serial.print(0x00,BYTE); //Terminator
}
I am confused because I was able to pass the character arrays to this function using the LB_GPS library functions for example:
void loop() {
GPS.getRaw(100);
GPS.GPSStringExplode(GPS.inBuffer,',');
LED.LED_PrintString(GPS.arguments[1], 0x00, 0x1d, 0x00, 0x02, 0, 0x00, 0x00, 0x01, 0x02); //print time value
}
I tried using:
LED.LED_PrintString((char*)linea[j], 0x00, 0x1d, 0x00, 0x02, 0, 0x00, 0x00, 0x01, 0x02);
and it would compile but it would not display the data. Thanks!