OK, I got it to actually do something. However, I am not sure how to implement the button, so it is not waiting for a button push. It is simply looping through the LED menu. I am assuming an "if" statement of some sort within each case?
Here is the revised code.
Thanks for your helpfulness. It means a lot!!
/*
LCD portion of the code. Sets up the pins
and intro screen.
The circuit:
* LCD RS pin to digital pin 2
* LCD Enable pin to digital pin 3
* LCD D4 pin to digital pin 4
* LCD D5 pin to digital pin 5
* LCD D6 pin to digital pin 6
* LCD D7 pin to digital pin 7
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
http://www.arduino.cc/en/Tutorial/LiquidCrystal
*/
// include the library code:
#include
// initialize the 4 bit LCD library with the numbers of the interface pins
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
// set pin numbers:
int switchPin1 =12; // switch1 is connected to pin 12
int switchPin2 =11; // switch2 is connected to pin 11
int switchPin3 =10; // switch3 is connected to pin 10
int switchPin4 =9; // switch4 is connected to pin 9
int switchPin5 =8; // switch5 is connected to pin 8
int led1Pin = 13;
int led2Pin = 8;
int led3Pin = 9;
int led4Pin = 10;
int led5Pin = 1;
int val; // variable for reading the pin status
int val2; // variable for reading the delayed status
int buttonState; // variable to hold the button state
int lightMode; // What mode is the light in?
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void setup() {
//LCD SETUP
// set up the LCD's number of rows and columns:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("**MIDI NIGHTS**");
delay (1000);
lcd.setCursor(0, 4);
lcd.print("LED Menu Options");
delay (1000);
lcd.clear();
// resets cursor position
lcd.setCursor(0, 4);
lcd.print(" Use right/left buttons to select LED ");
delay (20);
// scroll 150 positions (string length) to the left
// to move it offscreen left:
for (int positionCounter = 0; positionCounter < 27; positionCounter++) {
// scroll one position left:
lcd.scrollDisplayLeft();
// wait a bit:
delay(50);
}
lcd.clear(); //clear screen and reset cursor
lcd.setCursor(1, 9);
lcd.print("Select LED < >"); //Select desired LED
delay (4000); // delays on this screen then goes to led choices
//BUTTON SETUP
pinMode(switchPin1, INPUT); // Set the switch pin as input for menu right
pinMode(switchPin2, INPUT); // Set the switch pin as input for menu left
pinMode(switchPin3, INPUT); // Set the switch pin as input for menu up
pinMode(switchPin4, INPUT); // Set the switch pin as input for menu down
pinMode(switchPin5, INPUT); // Set the switch pin as input for menu store
pinMode(led1Pin, OUTPUT); // leds outputs that will eventually become the LEDs 1-33 (11 LED selections with three colors each)
pinMode(led2Pin, OUTPUT); // right now they each button press lights up the same light
pinMode(led3Pin, OUTPUT); // ultimate goal is to charlieplex with decoder and latches
pinMode(led4Pin, OUTPUT);
pinMode(led5Pin, OUTPUT);
Serial.begin(9600); // Set up serial communication at 9600bps
buttonState = digitalRead(switchPin1); // read the initial state
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void loop() {
switch (lightMode){
// Now do whatever the lightMode indicates
case 0: lightMode = 1;
digitalWrite(led1Pin, HIGH);
lcd.clear();
lcd.print("LED 1");
delay (100);
break;
case 1: lightMode = 2;
digitalWrite(led1Pin, HIGH); //turns on LED
lcd.clear(); // clears screen
lcd.print("LED 2"); // name of led
delay (100); // delay to keep the lCD from flashing so much while looping, not exactly what I am after
break;
case 2: lightMode = 3;
digitalWrite(led1Pin, HIGH);
lcd.clear();
lcd.print("LED 3");
delay (100);
break;
case 3: lightMode = 4;
digitalWrite(led1Pin, HIGH);
lcd.clear();
lcd.print("LED 4");
delay (100);
break;
case 4: lightMode = 5;
digitalWrite(led1Pin, HIGH);
lcd.clear();
lcd.print("LED 5");
delay (100);
break;
case 5: lightMode = 6;
digitalWrite(led1Pin, HIGH);
lcd.clear();
lcd.print("LED 6");
delay (100);
case 6: lightMode = 0;
break;
}
}