Programming and Result: Creating a Functions to Display a Number or String at a Specified Location on the LCD
Share
Using the commands and sending characters to the LCD to put a number on the screen at a specified location takes a few lines of code, where this is not necessary. The code can be put into a function since it will be used quite often.
The two functions are as follows: void Send_A_StringToMrLCDWithLocation(uint8_t x, uint8_t y, char *StringOfCharacters) { GotoMrLCDsLocation(x, y); Send_A_String(StringOfCharacters); } void Send_An_IntegerToMrLCD(uint8_t x, uint8_t y, int IntegerToDisplay , char NumberOfDigits) { char StringToDisplay[NumberOfDigits]; itoa(IntegerToDisplay, StringToDisplay, 10); GotoMrLCDsLocation(x, y); for (int i=0; i (less than symbol) NumberOfDigits;i++) Send_A_String(" "); Send_A_StringToMrLCDWithLocation(x, y, StringToDisplay); } The (less than symbol) isthe actualy symbol, not the phrase in the parenthesis.