Created
October 28, 2014 16:15
-
-
Save ledlogic/885816911fa49e32c8f2 to your computer and use it in GitHub Desktop.
A setup for the Alphabet Game - three buttons are required, and players attempt to be the first to find the next letter.
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 lcd(8, 9, 4, 5, 6, 7); // select the pins used on the LCD panel | |
int bluePin = 11; | |
int greenPin = 12; | |
int redPin = 13; | |
void setup() | |
{ | |
lcd.begin(16, 2); | |
lcd.setCursor(0, 0); | |
lcd.print("Alphabet Game"); | |
lcd.setCursor(0, 1); | |
lcd.print("ledlogic"); | |
pinMode(bluePin, INPUT_PULLUP); | |
pinMode(greenPin, INPUT_PULLUP); | |
pinMode(redPin, INPUT_PULLUP); | |
} | |
void loop() | |
{ | |
if (digitalRead(redPin) == LOW) { | |
lcd.setCursor(0, 1); | |
lcd.print("red "); | |
return; | |
} else if (digitalRead(greenPin) == LOW) { | |
lcd.setCursor(0, 1); | |
lcd.print("green "); | |
return; | |
} else if (digitalRead(bluePin) == LOW) { | |
lcd.setCursor(0, 1); | |
lcd.print("blue "); | |
} else { | |
lcd.setCursor(0, 1); | |
lcd.print(" "); | |
} | |
delay(100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment