I am trying to print temperature value and voltage value on oled but i observed weird behavior on display when i am just printing letter v and t it is printing correctly on oled but when i want to print value along with that it is not printing properly . Below i am attaching both images
#include <Tiny4kOLED.h>
const DCfont *currentFont = FONT8X16P;
const float R1 = 10000.0;
const float A = 2.108508173e-03, B = 0.7979204727e-04, C = 6.535076315e-07;
uint8_t width = 128;
uint8_t height = 32;
float calculateTemperature(uint16_t value)
{
float R2 = R1 * (1023.0 / (float)value - 1.0);
float logR2 = log(R2);
float T = (1.0 / (A + B * logR2 + C * logR2 * logR2 * logR2));
T = T - 273.15;
return T;
}
void setup()
{
oled.begin(width, height, sizeof(tiny4koled_init_128x64br), tiny4koled_init_128x64br);
oled.on();
oled.setFont(currentFont);
oled.clear();
}
void loop()
{
// Read and convert the voltage
int raw_value = analogRead(A0);
float voltage = (raw_value * 5.0) / 1023.0;
// Read and convert the temperature
uint16_t raw_value1 = analogRead(A1);
float temperature = calculateTemperature(raw_value1);
// Update the display with the new values
oled.setCursor(5, 1);
oled.print(" V = ");
oled.print(voltage, 4);
oled.setCursor(5, 4);
oled.println(" T = ");
oled.print(temperature, 2);
delay(1000);
}

