Created
November 27, 2018 01:25
-
-
Save edenwaith/4637830c0887b9b3a62c5f340dee22a0 to your computer and use it in GitHub Desktop.
Take input from the keyboard and print it to a 16x2 LCD display.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <LiquidCrystal.h> | |
| // LiquidCrystal display with: | |
| // rs on pin 12 | |
| // rw on pin 11 | |
| // enable on pin 10 | |
| // d4-7 on pins 5 - 2 | |
| // LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2); | |
| // LiquidCrystal lcd(12, 11, 5, 4, 3, 2); | |
| // Per https://www.hobbyist.co.nz/?q=16x2-arduino-lcd-shield, | |
| LiquidCrystal lcd(8,9,4,5,6,7); | |
| void setup() { | |
| // put your setup code here, to run once: | |
| Serial.begin(9600); | |
| lcd.begin(2, 20); | |
| // lcd.begin(16, 2); | |
| lcd.clear(); | |
| lcd.setCursor(0, 0); | |
| lcd.print("Evil Genius"); | |
| lcd.setCursor(0, 1); | |
| lcd.print("Rules"); | |
| } | |
| void loop() { | |
| // put your main code here, to run repeatedly: | |
| if (Serial.available()) | |
| { | |
| char ch = Serial.read(); | |
| if (ch == '#') | |
| { | |
| lcd.clear(); | |
| } | |
| else if (ch == '/') | |
| { | |
| lcd.setCursor(0,1); | |
| } | |
| else | |
| { | |
| lcd.write(ch); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment