0% found this document useful (0 votes)
2 views4 pages

Lab 6 - EENG312

The document outlines a laboratory experiment for EENG312 focused on serial communication using Arduino and the LiquidCrystal library. Students will edit and run a provided C++ program to display text on an LCD screen and learn to use Serial.available and Serial.read commands. Additionally, a homework assignment is given to create a program that displays personal information on the LCD with a blinking effect.

Uploaded by

Zeynep Bayram
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Lab 6 - EENG312

The document outlines a laboratory experiment for EENG312 focused on serial communication using Arduino and the LiquidCrystal library. Students will edit and run a provided C++ program to display text on an LCD screen and learn to use Serial.available and Serial.read commands. Additionally, a homework assignment is given to create a program that displays personal information on the LCD with a blinking effect.

Uploaded by

Zeynep Bayram
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

EENG312: Microcontroller Applications

Laboratory Study: Experiment 6


Serial Communication

Objective: The students will be introduced to serial communications in Arduino. The


students will learn about the LiquidCrystal library as well as the implementation of
Serial.available and Serial.read commands.

Lab Work - 1: Each group of students will edit and run the following Program in the IDE and
Tinkercad and debug to make it ready to be uploaded to Arduino Uno. The program sends
text to be shown on the LCD screen.
// C++ code
/*
LiquidCrystal Library - Serial Read
*/
#include <LiquidCrystal.h>

int cursor = 0;
int character = 0;
//connection pins
LiquidCrystal lcd_1(12, 11, 5, 4, 3, 2);

void setup()
{
lcd_1.begin(16, 2); // Set up the number of columns and rows on the LCD.

// Print a message to the LCD.


lcd_1.print("hello world!");
Serial.begin(9600);
}

void loop()
{

if (Serial.available()>0)
{
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting
// begins with 0):
lcd_1.setCursor(cursor, 1);
// print the character read from Serial Monitor:
character = Serial.read();
//if the character is 'space'
if (character == ' ')
{
//reset the second row
for (int i = 0; i <= cursor; i++)
{
lcd_1.setCursor(i, 1);
lcd_1.print(" ");
}
//put the cursor back to the start position
cursor = 0;

else
{
//print character recieved via Serial connection
lcd_1.print(char(character));
//move cursor right one position
cursor++;
}

delay(100); // Wait for 1000 millisecond(s)


}

}
HW 6. (Due Next Friday)
Write a program with the respective Tinkercad circuit design to display your name, surname,
and student number on an LCD screen. The text should be blinking (on for 2 seconds and off
for 0.5 seconds).
HINT: You can use the lcd.clear() function to clear the text.

You might also like