0% found this document useful (0 votes)
30 views3 pages

LCD Grove

The document shows code for initializing and controlling an LCD display using an Arduino. It includes initializing the LCD library, printing text to the display, and shifting text across the screen over time.

Uploaded by

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

LCD Grove

The document shows code for initializing and controlling an LCD display using an Arduino. It includes initializing the LCD library, printing text to the display, and shifting text across the screen over time.

Uploaded by

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

#include <Wire.

h> // include
Arduino Wire library
#include "rgb_lcd.h" // include Seeed
Studio LCD library

rgb_lcd lcd; // initialize LCD library

void setup() {
// initialize the LCD with 16 columns
and 2 rows:
lcd.begin(16, 2);

// move cursor to upper left position


(0, 0)
lcd.setCursor(0, 0);

// print text on the LCD


lcd.print(" Hello World");

char txt[] = "Welcome to the World of


Microcontrollers";

lcd.setCursor(0, 1); // move cursor


to second row
lcd.print(txt); // print text
array
delay(1000); // wait a second

while(txt[0] != '\0')
{
byte i = 0;
lcd.setCursor(0, 1);
while(txt[i] != '\0') // shift the
text array to the left by 1 position
{
lcd.write(txt[i]); // print one
character
txt[i] = txt[i+1]; // shift the
text array to the left
i++;
}

lcd.write(' '); // print a space


delay(1000); // wait 200
milliseconds
}
delay(1000); // wait a second
}

// main loop
void loop() {
lcd.setCursor(0, 1); // move cursor
to position (0, 1)

// print number of seconds since the


lase reset
lcd.print( millis()/1000 );

delay(200); // wait 200


milliseconds
}

You might also like