Pages: [1]   Go Down
Author Topic: Put serial input string on an LCD screen  (Read 205 times)
0 Members and 1 Guest are viewing this topic.
US
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is my current program:
Code:
#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?
« Last Edit: January 26, 2013, 12:45:46 pm by lawm » Logged

East Anglia (UK)
Offline Offline
Faraday Member
**
Karma: 89
Posts: 3452
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ? 
Logged

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Pages: [1]   Go Up
Jump to: