I need help in Visuino ( LCD Display format)

Hello,

Iam new in Programming Arduino with Visuino, and I have a problem

I have a counter on a 1602 Display

The Standart counting Format is from left to right, how can i counting from the right side of the display to the left side?

Example this is what i have: 777.....

This is what i want: .....777

I hope you can help me

The Arduino LiquidCrystal library has the rightToLeft() function. Perhaps the library that you are using has something similar?

You can use sprintf/snprintf to first store a line in a text buffer and next print that text buffer. The below demonstrates using serial monitor.

// text buffer; size is for 16 characters plus terminating '\0'
char buffer[17];

void setup()
{
  Serial.begin(57600);
}

void loop()
{
  static int counter = 0x7FFF;
  snprintf(buffer, sizeof(buffer), "'%-5s' '%6d'", "txt", counter++);
  Serial.println(buffer);
  delay(1500);
}

This will print as shown below. For clarity, the code wastes some space. %-5s will print a text with a minimum of 5 characters, left aligned. %6d prints a signed integer with a minimum of 6 positions; reason for 6 positions is that a signed integer is a maximum of 5 digits and a minus sign. You can start the counter at 0 to see the effect.

'txt  ' ' 32767'
'txt  ' '-32768'
'txt  ' '-32767'
'txt  ' '-32766'

The total length should not exceed 20 characters or the result will be truncated at the end.; I've wasted tome space with the single ticks and the additional space.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.