Print Variable value - oled

Hi

i have modify one code to my needs but i cant figure out how to print a message based in a variable from analog input

lets say that in Analog A0 have a range of 0-5v and i want my display print a massage '' welcome'' if the value is from 0.5 volt until 1.5 volt

int sensorValue = analogRead(A0);
float f = sensorValue * (5.0 / 1023.0);
if(f >= 0.50 && f <= 1.50){

the code that is working in my project is this one :

#include "U8glib.h"
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);  // Display which does not send AC

bool first;
float analogA = 0.0;  // Analog reading A0
float analogB = 0.0; //  Analog reading A1
float analogC = 0.0; //  Analog reading A2
void test(float* analogA, float* analogB, float* analogC);

void setup(void)
{

// flip screen, if required
//u8g.setRot180();

  Serial.begin(9600);
 

  // assign default color value
  if (u8g.getMode() == U8G_MODE_R3G3B2)
  {
    u8g.setColorIndex(255);     // white
  }
  else if (u8g.getMode() == U8G_MODE_GRAY2BIT)
  {
    u8g.setColorIndex(3);         // max intensity
  }
  else if (u8g.getMode() == U8G_MODE_BW)
  {
    u8g.setColorIndex(1);         // pixel on
  }
  else if (u8g.getMode() == U8G_MODE_HICOLOR)
  {
    u8g.setHiColorByRGB(255, 255, 255);
  }

  
}
void Meter(float* analogA, float* analogB, float* analogC)
{
  u8g.setFont(u8g_font_fub11);
  u8g.setFontRefHeightExtendedText();
  u8g.setDefaultForegroundColor();
  u8g.setFontPosTop();
  u8g.drawStr(4, 0, "InputA");
  u8g.setPrintPos(80, 0);
  u8g.print(*analogA);
  u8g.drawStr(4, 20, "InputB");
  u8g.setPrintPos(80, 20);
  u8g.print(*analogB);
  u8g.drawStr(4, 40, "InputC");
  u8g.setPrintPos(80, 40);
  u8g.print(*analogC);

}

void loop(void){

  test(&analogA, &analogB, &analogC);

  if (first)
  {
    first = false;
  }
  else
  {
    u8g.firstPage();

    do
    {
      Meter(&analogA, &analogB, &analogC);
    }
    while (u8g.nextPage());
  }
}
void test(float* analogA, float* analogB, float* analogC)
{
  
int sensorValue = analogRead(A0);
float h = sensorValue * (5.0 / 1023.0);
int sensorValueB = analogRead(A1);
float w = sensorValueB * (5.0 / 1023.0);
int sensorValueC = analogRead(A1);
float x = sensorValueC * (5.0 / 1023.0);


  delay(500);
  *analogA = 0;
  *analogB = 0;
  *analogC = 0;
  
*analogA = h;
*analogB = w;
*analogB = x;
    


}

any help will be appreciate

thanks in advance

ps : i am very new in Arduino program and programming in general... just learning through making projects :slight_smile:

drawStr seems to me to be the solution.
What's the problem?

Hi thanks for the quick reply

the problem is that i dont know how to declare the float *analogA to saw the texts i want to be displayed based from the values of the Analog input A0

in the code i have a standar text to be displayed permanently and in the right side area have text changing based in the input values

u8g.setFont(u8g_font_fub11);
  u8g.setFontRefHeightExtendedText();
  u8g.setDefaultForegroundColor();
  u8g.setFontPosTop();
  u8g.drawStr(4, 0, "InputA");
  u8g.setPrintPos(80, 0);
  u8g.print(*analogA);

so i need the u8g.print(*analogA); take text based in

int sensorValue = analogRead(A0);
float f = sensorValue * (5.0 / 1023.0);
if(f >= 0.50 && f <= 1.50){


}
        else if (f  >= 1.50 && f  <= 2.50){


}