I just picked up my first character display and I'm having a few issues displaying characters on it. So first off, using the hello, world sample code it is working mostly fine. I get a weird character at the very end of the string that I didn't enter. attached photo helloworldchar.jpg
The bigger issue I'm having is the C++ code I'm writing and having issues sending text to the display.
So I have three files. A header and source file that contains a bunch of functions that call the different commands listed in the Manual. For instance.
Code: Select all
void setAutoScroll (int state = 0); // state 0 = off, 1 = on
void ClearScreen ();
void changeStartupScreen (char data);
void setAutoLineWrap (int state = 0); // state 0 = off, 1 = on
void setCursorPosition (int col = 0, int row = 0);
void goHome ();
void moveCursor (int state, int positions = 0); // state 0 = off, 1 = on, positions = number of positions to move
void underlineCursor (int state); // state 0 = off, 1 = on
void blinkingCursor (int state); // state 0 = off, 1 = on
so when I create an object of the Character_Display class in the constructor is where I create my connection to the USB port and set the attributes.
I have a function that is simply writeToDisplay() that takes in a unsigned char array, and writes it to the display.
Code: Select all
void Character_Display::writeToDisplay (unsigned char mesg[])
{
if (!WriteFile (my_port, &mesg, sizeof (mesg), &bytes_written, NULL)) //Write message
{
std::cout << "Error writing message to display!" << std::endl; //Check for errors in writing, call GetLastError with the int response for more info
}
}
what I'm doing is as follows.
main method
Code: Select all
Character_display cd; // create object
unsigned char message[] = "Test 1";
cd.ClearScreen();
cd.writeToScreen(message);