Good day to all,
I have been working on a project, on and off, for over a year now and at long last all the parts are in my possession, so I started testing my sketch to see if everything works. Since I have not been receiving replies on the project thread, I decided to start a new thread which will mainly focus on the LCD.
Though this LCD from 4D Systems is a wonderful addition to a project, it is not hassle free...especially since I got into electronics for the sake of this project. My tendency to overcomplicate things does not help either.
So here is the first post tackling the first issue I have:
I have quite a few forms(pages) on the LCD, three of which has an on-screen keyboard which captures info (Job Title, Job Number, Date) and a string object to display what has been typed.
When I test the sketch, the string object only displays the last letter that's been typed and not the whole string.
Here is a snippet of the code I use for this purpose:
if (Event.reportObject.object == GENIE_OBJ_KEYBOARD) // Check whether Report Message was from a Keyboard
{
int kbrdIndex = Event.reportObject.index;
switch (kbrdIndex)
{
case 0:
{
kbValue[keyCounter] = LCD.GetEventData(&Event); // Write key value to jobTitle variable
if(kbValue[keyCounter] == 8) //Check for Backspace
{
keyCounter--;
kbValue[keyCounter] = ' ';
LCD.WriteStr(1, kbValue);
keyCounter--;
}
else
{
jobTitle += kbValue[keyCounter];
LCD.WriteStr(1, kbValue);
}
keyCounter = keyCounter + 1;
break;
}
case 1:
{
kbValue[keyCounter] = LCD.GetEventData(&Event); // Write key value to dateTitle variable
if(kbValue[keyCounter] == 8) //Check for Backspace
{
keyCounter--;
kbValue[keyCounter] = ' ';
keyCounter--;
}
else
{
date += kbValue[keyCounter];
LCD.WriteStr(7, kbValue);
}
keyCounter = keyCounter + 1;
break;
}
case 2:
{
kbValue[keyCounter] = LCD.GetEventData(&Event); // Write key value to jobNum variable
if(kbValue[keyCounter] == 8) //Check for Backspace
{
keyCounter--;
kbValue[keyCounter] = ' ';
keyCounter--;
}
else
{
jobNum += kbValue[keyCounter];
LCD.WriteStr(0, kbValue);
}
keyCounter = keyCounter + 1;
break;
}
}
}
If anyone can check to see if they find issues with my code, I'd be extremely great full.
Regards,
Martin