#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
int menuVariables[5] = { 180, 30, 170, 150, 60 };
char menuUnits[][5] = { "cm", "cm", "cm", "cm", "min" };
char buf[10]; // Change this value accordingly (max string length + 1)
void setup()
{
Serial.begin(115200); // Debugging only
lcd.init();
lcd.backlight();
lcd.clear();
int lcdMenu = 0; // Test value
lcd.setCursor(0, 0);
lcd.print(" - TEST CODE - ");
sprintf(buf, "%3d%s", menuVariables[lcdMenu-1], menuUnits[lcdMenu-1]);
lcd.setCursor(16 - strlen(buf), 1);
lcd.print(buf);
}
void loop()
{
}