I'm trying to display the text I write into the serial monitor onto the LCD screen. I'm trying to perform string character analysis through the serial monitor and then see the text on LCD screen. Right now only random letters are being shown on the LCD while its working through string analysis. The code I've got right now is:
// Import the Liquid Crystal library
#include<LiquidCrystal.h>;
//Initialise the LCD with the arduino. LiquidCrystal(rs, enable, d4, d5, d6, d7)
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// Open serial communications and wait for port to open:
lcd.begin(16, 2);
// Print these words to my LCD screen
lcd.print("HELLO WORLD!");
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect.
}
// send an introduction:
Serial.println("send any byte and I'll tell you everything I can about it");
Serial.println();
}
void loop() {
// get any incoming bytes:
if (Serial.available() > 0) {
int thisChar = Serial.read();
// say what was sent:
if (isUpperCase(thisChar)) { // tests if thisChar is an upper case letter
Serial.println("The character is upper case");
}
else {
Serial.println("The character is not upper case");
}
if (isAlphaNumeric(thisChar)) { // tests if thisChar isa letter or a number
Serial.println("The character is alphanumeric");
}
else {
Serial.println("The character is not alphanumeric");
}
if (isAlpha(thisChar)) { // tests if thisChar is a letter
Serial.println("The character is a letter");
}
else {
Serial.println("The character is not a letter");
}
if (isAscii(thisChar)) { // tests if thisChar is an Ascii character
Serial.println("The character is Ascii");
}
else {
Serial.println("The character is not Ascii");
}
if (isWhitespace(thisChar)) { // tests if thisChar is a white space
Serial.println("The character is a white space");
}
else {
Serial.println("The character is not a white space");
}
if (isControl(thisChar)) { // tests if thisChar is a control character
Serial.println("The character is a control character");
}
else {
Serial.println("The character is not a control character");
}
if (isDigit(thisChar)) { // tests if thisChar is a digit
Serial.println("The character is a number");
}
else {
Serial.println("The character is not a number");
}
if (isGraph(thisChar)) { // tests if thisChar is a graph
Serial.println("The character is a printable charater thats not whitespace");
}
else {
Serial.println("The character is not a printabe character thats not whitespace");
}
if (isLowerCase(thisChar)) { // tests if thisChar is a lower case letter
Serial.println("The character is lower case");
}
else {
Serial.println("The character is not lower case");
}
if (isPrintable(thisChar)) { // tests if thisChar is printable char
Serial.println("The character is printable");
}
else {
Serial.println("The character is not printable");
}
if (isPunct(thisChar)) { // tests if thisChar is a punctuation character
Serial.println("The character is a punctuation");
}
else {
Serial.println("The character is not a punctuation");
}
if (isSpace(thisChar)) { // tests if thisChar is a white-space character
Serial.println("The character is white-space");
}
else {
Serial.println("The character is not white-space");
}
if (isHexadecimalDigit(thisChar)) { // tests if thisChar is an hexadecimal digit
Serial.println("The character is an hexadecimal digit");
}
else {
Serial.println("The character is not an hexadecimal digit");
}
Serial.print("You sent me: \'");
Serial.write(thisChar);
Serial.print("\' ASCII Value: ");
Serial.println(thisChar);
// add some space and ask for another byte:
Serial.println();
Serial.println("Give me another byte:");
Serial.println();
if (Serial.available()) {
//wait for entire message to arrive
delay(600);
//clear the screen
lcd.clear();
lcd.write(Serial.read());
}
}}