You are on page 1of 1

Module 3 Assignment Solution

Solution:
Use the following code if you have connected your LCD as per
the given circuit diagram.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
lcd.begin(16, 2);
}

String mypattern = "Hello World!";


int strlength = mypattern.length();

void loop() {
lcd.print(mypattern);
delay(1000);
for (int positionCounter = 0; positionCounter <= strlength;
positionCounter++) {
lcd.scrollDisplayLeft();
delay(150);
}
for (int positionCounter = 0; positionCounter <= strlength+16;
positionCounter++) {
lcd.scrollDisplayRight();
delay(150);
}

for (int positionCounter = 0; positionCounter < 16;


positionCounter++) {
lcd.scrollDisplayLeft();
delay(150);
}
delay(1000);
}

The Tinkercad circuit is available at:


https://www.tinkercad.com/things/hnbfl4nhtEZ

You might also like