Hello Arduino

For my first Arduino experience I made some minor changes to the LiquidCrystal -> HelloWorld example so the 2 lines of text would scroll in opposite directions. Ran it on an Adafruit Feather 32u4 Adalogger connected to a 16×2 LCD.

Exciting right? 😉

#include <LiquidCrystal.h>
LiquidCrystal lcd(5, 6, 9, 20, 19, 18);

void setup() {
  lcd.begin(16, 2);
  lcd.print("Hello");
  lcd.setCursor(10, 1);
  lcd.print("World!");
}
int i = 1;
int j = 9;
void loop() {
  lcd.setCursor(i, 0);
  lcd.print("Hello");
  lcd.setCursor(j, 1);
  lcd.print("World!");
  i++;
  if (i > 10) {
    i = 0;
  }
  j--;
  if (j < 0) {
    j = 10;
  }
delay(1000);
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s