I am trying print voltage and temperature value which first i am converting to string and then printing on oled but getting error text section exceeds available space in board
But when i tried assigning value directly to string array it is printing properly but when assigning to float and converting it to string it is showing error.
#include <Tiny4kOLED.h>
extern "C" void __cxa_pure_virtual() { while (1); }
char vtg[5] ; // Example voltage value
char temp[5] ;
const DCfont *currentFont = FONT8X16P;
void setup() {
oled.begin(128, 64, sizeof(tiny4koled_init_128x64br), tiny4koled_init_128x64br);
oled.clear();
oled.setFont(currentFont);
oled.on();
}
void loop()
{
float voltage = 23.5;
// Convert voltage to string and append "V"
dtostrf(voltage, 4, 2, vtg); // Convert float to string with 2 decimal places
strcat(vtg, "V"); // Append "V" to the voltage string
float temperature = 56;
dtostrf(temperature, 4, 2, temp); // Convert temperature to string with 2 decimal places
strcat(temp, "\xB0C"); // Append "°C" to the temperature string
// Update the display with the new values
oled.setCursor(0, 1);
oled.print(" "); // Clear previous value (adjust length as needed)
oled.setCursor(0, 1);
oled.print(vtg);
oled.setCursor(0, 3);
oled.print(" "); // Clear previous value (adjust length as needed)
oled.setCursor(0, 3);
oled.print(temp);
delay(1000); // Update every second (adjust as needed)
}