Go Down

Topic: Put serial input string on an LCD screen (Read 314 times) previous topic - next topic

lawm

Jan 26, 2013, 06:39 pm Last Edit: Jan 26, 2013, 06:45 pm by lawm Reason: 1
This is my current program:
Code: [Select]
#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
char prevValue;

void setup() {
 Serial.begin(9600);
   lcd.begin(16, 2);
   lcd.setCursor(0,0);
}

void loop() {
 if (Serial.available() > 0) {
   char value = Serial.read();
   if (prevValue != value){
     lcd.clear();
     prevValue = value;
   }
   Serial.println(prevValue);
   lcd.print(prevValue);
 }
}


When you type in any char in the serial monitor, it will print it on my LCD screen.
Now I want to make it read an entire string.  Also, the part of my program that listens for a new char to change the screen will not work if the inputted char is the same as the previous one. Any suggestions/help?

UKHeliBob

What line ending, if any, do you have selected in the serial monitor ?

Do you want the user to type a string, press Return and for the string to appear on the LCD or is each character entered individually followed by Return ? 
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy