error: invalid conversion from 'int8_t' to 'const char*'

I haven’t used Arduino for a little while and have tried to get this sketch to work.

Im getting the error:

Arduino: 1.0.6 (Windows 7), Board: “Arduino Pro or Pro Mini (5V, 16 MHz) w/ ATmega328”
sketch_sep24a.ino: In function ‘void loop()’:
sketch_sep24a:44: error: invalid conversion from ‘int8_t’ to ‘const char*’
sketch_sep24a:44: error: initializing argument 3 of ‘void IIC_without_ACK::Char_F6x8(unsigned char, unsigned char, const char*)’

Everything work fine, apart from the line near the bottom causing the issue. I need this changing variable to be displayed on the OLED.

Any help would be appreciated. I’ve tried various possible solutions but keep getting errors and putting it into an array i guess is a little beyond me.

Many thanks,

#include "NazaDecoderLib.h"
#include <SPI.h>
#include <Wire.h>
#include <IIC_without_ACK.h>
#include "oledfont.c"   //codetab

#define OLED_SDA A4
#define OLED_SCL A5

IIC_without_ACK display(OLED_SDA, OLED_SCL);//9 -- sda,10 -- scl

uint32_t currTime, attiTime;

void setup()
{
  Serial.begin(115200);
  display.Initial();
  display.Fill_Screen(0xf0);
  delay(2000);
  display.Fill_Screen(0x00);  
}

void loop()
{
  display.Char_F6x8(0,0,"");
  display.Char_F6x8(0,1,"GPS Tester");  

  
if(attiTime < currTime)
 {
 attiTime = currTime + 500000;

 display.Char_F6x8(0,1,"Pitch: ");
 }   
  
  currTime = micros();

  // Display attitude at 5Hz rate so every 200000 microseconds
  if(attiTime < currTime)
  {
    attiTime = currTime + 200000;
    display.Char_F6x8(0,3,"Pitch: "); //display.Char_F6x8(0,0,NazaDecoder.getPitch());
    display.Char_F6x8(0,4,"Roll: "); //display.Char_F6x8(0,0,NazaDecoder.getRoll());
//    display.Char_F6x8(40,3,NazaDecoder.getPitch());  // This line is causing the issue
    Serial.print("Pitch: "); Serial.print(NazaDecoder.getPitch());
    Serial.print(", Lat: "); Serial.print(NazaDecoder.getLat());
    Serial.print(", Lon: "); Serial.print(NazaDecoder.getLon());
    Serial.print(", Alt: "); Serial.print(NazaDecoder.getGpsAlt());
    Serial.print(", Fix: "); Serial.print(NazaDecoder.getFixType());
    Serial.print(", Sat: "); Serial.println(NazaDecoder.getNumSat());    
  }
}

//    display.Char_F6x8(40,3,NazaDecoder.getPitch());  // This line is causing the issueYou need to convert the result of the call to NazaDecoder.getPitch() into a character string, and send that string to the LCD.
Use of the function itoa() is one possibility, see itoa - C++ Reference

Many thanks for your help, it was really useful.

The issue was solved by using the itoa() command as suggested.

The necessary code now reads:

display.Char_F6x8(0,3,"Lat: "); display.Char_F6x8(40,3,(itoa(NazaDecoder.getLat(), buf, 10)));

This outputs to the OLED fine, however I am getting a reading of just 51 when I am expecting something such as 51.7696304.

How can I show the value to extra decimal places. If I use the serial window to view the readings, I am seeing 51.7696304 without issue.

Many thanks again.

So the value you need to convert is a float. Seehttp://dereenigne.org/arduino/arduino-float-to-string for converting a float (double) to a string (c-string).

How can I show the value to extra decimal places.

Perhaps by NOT using itoa() - integer to ASCII.