Header Ads

Display Serial Data on 16X2 LCD

This program is for Displaying data that Entered on the Serial Monitor of Arduino IDE.

Display Serial Data on 16X2 LCD


Component required

  • Arduino Uno
  • 16x2 LCD Screen
  • Potentiometer for Contrast Control
  • Jumper Wire

Arduino Code


#include <LiquidCrystal.h>

const int rs = 12, en = 11, d4 = 4, d5 = 5, d6 = 6, d7 = 7; 
LiquidCrystal lcd(rs, en, d4, d5,d6,d7);


void setup()
{
  lcd.begin(16,2);
  Serial.begin (9600);
  lcd.print("Myprogmaster!");   
}
void loop()
{
  // when characters arrive over the serial port...
  if (Serial.available()) 
  {
    // wait a bit for the entire message to arrive
    delay(100);
    // clear the screen
    lcd.clear();
    // read all the available characters
    while(Serial.available() > 0) 
    {
      // display each character to the LCD
      char val = Serial.read();
      lcd.write(val);
      Serial.print(val);
    }
  }
}

Schematic 

Interfacing Diagram


No comments:

Popular Posts

Theme images by 5ugarless. Powered by Blogger.