HELP! - Invalid conversion from 'char' to 'const char*' [-fpermisive]

Hi, guys. This may end up being a long post... please bear with me!

First off, disclaimer; although I am programing in the Arduino app, I am actually using a Heltec CubeCell HTCC-AB02S.

What I want to make is (1) a transmitter and (2) a tracker for playing airsoft (idea is to have one team take a package from point A to point B, but opposing team has a tracker to find them without their knowledge).

Original intention was to use radio direction finding, but that is just too inaccurate (as radio signals bounce off trees and such) and it ends up leading you in the wrong direction. In order to improve distance for the LoRa, I am using aftermarket antennas (one omnidirectional, one directional). BTW, in original tests (radio finding) I did not use the CubeCel, but a regular ESP32 LoRa with OLED.

What I want to do now is have the transmitter transmit its GPS coordinates to the tracker, and then have the tracker display the direction (arrow) to the transmitter and the distance to the transmitter (I intend to use a GY-85 module to calculate direction, but I am far from that at this point; in other words, that is not yet relevant!). The reason I chose the CubeCell HTCC-AB02S is that it has the OLED, LoRa and GPS all integrated.

The issue I am having is that I have not found a way to transmit the GPS coordinates. Here is the latest code I am currently working with for the transmitter:

//Libraries
#include "LoRaWan_APP.h"
#include "Arduino.h"
#include "HT_SSD1306Wire.h"
#include "GPS_Air530.h"
#include "GPS_Air530Z.h"
#include <Wire.h>
//GPS Setup
//if GPS module is Air530, use this
Air530Class GPS;
//if GPS module is Air530Z, use this
//Air530ZClass GPS;
//Display Setup
extern SSD1306Wire  display; 
int fracPart(double val, int n)
{
  return (int)((val - (int)(val))*pow(10,n));
}
// LoRa Setup Values
#ifndef LoraWan_RGB
#define LoraWan_RGB 0
#endif
#define RF_FREQUENCY                                915000000 // Hz
#define TX_OUTPUT_POWER                             14        // dBm
#define LORA_BANDWIDTH                              0         // [0: 125 kHz,
                                                              //  1: 250 kHz,
                                                              //  2: 500 kHz,
                                                              //  3: Reserved]
#define LORA_SPREADING_FACTOR                       7         // [SF7..SF12]
#define LORA_CODINGRATE                             1         // [1: 4/5,
                                                              //  2: 4/6,
                                                              //  3: 4/7,
                                                              //  4: 4/8]
#define LORA_PREAMBLE_LENGTH                        8         // Same for Tx and Rx
#define LORA_SYMBOL_TIMEOUT                         0         // Symbols
#define LORA_FIX_LENGTH_PAYLOAD_ON                  false
#define LORA_IQ_INVERSION_ON                        false
#define RX_TIMEOUT_VALUE                            1000
#define BUFFER_SIZE                                 30 // Define the payload size here
//Tx Package Variables
char txpacket[BUFFER_SIZE];
char rxpacket[BUFFER_SIZE];
char TxLatitude;
char TxLongitude[BUFFER_SIZE];
char TxSpeed;
char TxAltitude;
char TxSatelite;
char TxHdop;
static RadioEvents_t RadioEvents;
void OnTxDone( void );
void OnTxTimeout( void );
typedef enum
{
    RX,
    TX,
}States_t;
States_t state;
//---------------------------OnTxDone------------------------------
void OnTxDone( void )
{
  turnOnRGB(0,0);
  state=TX;
}
//---------------------------OnTxTimeout------------------------------
void OnTxTimeout( void )
{
    Radio.Sleep( );
    state=TX;
}
//----------------------------SETUP-------------------------------
void setup() {
  pinMode(Vext,OUTPUT);
  digitalWrite(Vext, LOW);
  delay(10);
  display.init();
  //display.flipScreenVertically();
  display.clear();
  display.display();
  display.setTextAlignment(TEXT_ALIGN_CENTER);
  display.setFont(ArialMT_Plain_16);
  display.drawString(64, 32-16/2, "GPS initing...");
  display.display();
  Serial.begin(115200);
  GPS.begin();
  GPS.setmode(MODE_GPS_GLONASS);
  //GPS.setmode(MODE_GPS_BEIDOU_GLONASS);  //only Air530Z supported.
  pinMode(P3_3,INPUT);
  RadioEvents.TxDone = OnTxDone;
  RadioEvents.TxTimeout = OnTxTimeout;
// Radio Tx Configuration in Lora mode
  Radio.Init( &RadioEvents );
  Radio.SetChannel( RF_FREQUENCY );
  Radio.SetTxConfig( MODEM_LORA, TX_OUTPUT_POWER, 0, LORA_BANDWIDTH,
                                 LORA_SPREADING_FACTOR, LORA_CODINGRATE,
                                 LORA_PREAMBLE_LENGTH, LORA_FIX_LENGTH_PAYLOAD_ON,
                                 true, 0, 0, LORA_IQ_INVERSION_ON, 3000 );
  state=TX;
}
//----------------------------LOOP-------------------------------
void loop()
{
  uint32_t starttime = millis();
  while( (millis()-starttime) < 1000 )
  {
    while (GPS.available() > 0)
    {
      GPS.encode(GPS.read());
    }
  }
  char str[30];
  display.clear();
  display.setFont(ArialMT_Plain_10);
  int index = sprintf(str,"%02d-%02d-%02d",GPS.date.year(),GPS.date.day(),GPS.date.month());
  str[index] = 0;
  display.setTextAlignment(TEXT_ALIGN_LEFT);
  display.drawString(0, 0, str);
  index = sprintf(str,"%02d:%02d:%02d",GPS.time.hour(),GPS.time.minute(),GPS.time.second(),GPS.time.centisecond());
  str[index] = 0;
  display.drawString(60, 0, str);
  if( GPS.location.age() < 1000 )
  {
    display.drawString(120, 0, "A");
  }
  else
  {
    display.drawString(120, 0, "V");
  }
  index = sprintf(str,"alt: %d.%d",(int)GPS.altitude.meters(),fracPart(GPS.altitude.meters(),2));
  str[index] = 0;
  display.drawString(0, 16, str);
  TxAltitude = GPS.altitude.meters();
  Radio.IrqProcess( );
     // HDOP: 
     // The effect of the Dilution of Precision on the horizontal position value. The more good visible 
     // satellites low in the sky, the better the HDOP and the horizontal position (Latitude and Longitude) are.
     // 1 = Ideal
     // 1~2 = Excellent
     // 2~5 = Good
     // 5~10 =  Moderate
     // 10~20 = Fair
     // >20 = Poor
  index = sprintf(str,"hdop: %d.%d",(int)GPS.hdop.hdop(),fracPart(GPS.hdop.hdop(),2));
  str[index] = 0;
  display.drawString(0, 32, str); 
  TxHdop = GPS.hdop.hdop();
  Radio.IrqProcess( );
     // Para la ubicacion de GPS, el primer decimal nos lleva a un rango de 11.1 Km
     // 2 decimales dan un rango de 1.1Km, 3 decimales 110m, 4 decimales 11m, y 5 decimales 1.1m
     // 6 decimales son 11cm, que es mucho menos que la exactitud de este GPS
  index = sprintf(str,"lat :  %d.%d",(int)GPS.location.lat(),fracPart(GPS.location.lat(),6));
  str[index] = 0;
  display.drawString(60, 16, str); 
  Serial.print("Latitud: ");
  if( GPS.location.age() < 1000 )
    {
      Serial.print((int)GPS.location.lat() );
      Serial.print(".");
      Serial.println(abs(fracPart(GPS.location.lat(),6)));
    }
    else
  {
    Serial.println(0);
  }
  TxLatitude = GPS.location.lat();
  Radio.Send( (uint8_t *)TxLatitude, strlen(TxLatitude) );
  Radio.IrqProcess( ); 
  index = sprintf(str,"lon:%d.%d",(int)GPS.location.lng(),fracPart(GPS.location.lng(),5));
  str[index] = 0;
  display.drawString(60, 32, str);
  Serial.print("Longitud: ");
    if( GPS.location.age() < 1000 )
    {
     Serial.print((int)GPS.location.lng());
     Serial.print(".");
     Serial.println(abs(fracPart(GPS.location.lng(),5)));
    }
    else
  {
    Serial.println(0);
  }
//  TxLongitude = GPS.location.lng();
//  Radio.Send( (uint8_t *)TxLongitude, strlen(TxLongitude) );
  Radio.IrqProcess( );
  index = sprintf(str,"speed: %d.%d km/h",(int)GPS.speed.kmph(),fracPart(GPS.speed.kmph(),1));
  str[index] = 0;
  display.drawString(0, 48, str);
  display.display();
  TxSpeed = GPS.speed.kmph();
  Radio.IrqProcess( );
  index = sprintf(str,"sat: %d",(int)GPS.satellites.value());
  str[index] = 0;
  display.drawString(95, 48, str);
  display.display();
  Serial.print("Satelites: ");
  Serial.println((int)GPS.satellites.value());
  TxSatelite =  GPS.satellites.value();  
  Radio.IrqProcess( );
  delay (1000);
}

The idea is to add a similar line to this for longitud and latitud, but this is the line where I get the error:

// Radio.Send( (uint8_t *)TxLongitude, strlen(TxLongitude) );

The error I get is:

Invalid conversion from 'char' to 'const char*' [-fpermisive]

I do not know if I need to take another approach or what. But I need to get the longitude and latitude to the tracker, and it is just not working.

I am a complete novice to this (I have done about 6 or 7 Arduino projects, and that's about it), so any advice on how to get this done will be greatly appreciated!

Did you forget to convert an integer to a string (char array)?

How do I do that? As I said, rookie here...

One place to start would be to learn about the basic data types.

Is TxLatitude a character array (with what length), a floating point variable, or a long integer?

What is the data type and return value of the function GPS.location.lat()?

You have bitten off a lot for a complete beginner, so expect some challenges.

Edit: I see you have been at this for a while now, with no progress:

I can print the LAT and LON on the screen (OLED or Serial). What I get is the number (decimals depend on what I set it for). I would imagine it is a floating point, as it has decimals, but I do not know how to know for sure.

As for biting off a lot, maybe. But I do like to challenge myself!

As I mentioned, originally I intended to do simple radio location (and I had that working) with signal strength and a directional antenna. But I was not counting on reflections, which kind of ruined that idea... So unintentionally I walked into a mine field! But I am intending to get to the other side!!!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.