Lab 6 - EENG312
Lab 6 - EENG312
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.
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++;
}
}
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.