int buttonState1 = 0;
int buttonState2 = 0;
int buttonPin1 = 4;
int buttonPin2 = 6;
int power = 0;
int menuState = 0; //Channel Surf = 1, Channel input = 2, Volume = 3, Power = 4;
int displayState = 0; //Channel Surf = 1, Channel input = 2, Volume = 3, Power = 4;
int CS = 0; //Channel up = 1, Channel down = 2, Exit = 3
int CI = 0; //hundreds = 1, tens = 2, single = 3, Exit = 4
void setup(){
Serial.begin(9600);
}
void loop(){
buttonState1 = digitalRead(buttonPin1);
buttonState2 = digitalRead(buttonPin2);
if(power == 0){
if(buttonState1 == 1){
power = 1;
}
else if(buttonState2 == 1){
power = 1;
}
if(power == 1){
//transmit code to turn power on
displayState = 1;
}
buttonState1 = 0;
buttonState2 = 0;
}
if (power == 1){
//switch through main menu
if(menuState == 0){
if(displayState == 1){
//LCD Displays Channel Surf Menu
}
if(displayState == 2){
//LCD Displays Channel Input menu
}
if(displayState == 3){
//LCD Displays Volume Menu
}
if(displayState == 4){
//LCD Displays Power Menu
}
if(buttonState2 == 1){
displayState = displayState + 1;
if(displayState == 5){
displayState = 1;
}
}
}
//go into the menu (not just display)
if(buttonState1 = 1){
menuState = displayState;
}
//Channel Surf Menu
if (menuState == 1){
CS = 1;
if(buttonState2 == 1){
CS = CS+1;
if(CS == 4){
CS = 1;
}
}
if(CS == 1){
if(buttonState1 == 1){
//transmit code to switch channel up
}
}
if(CS == 2){
if(buttonState1 == 1){
//transmit code to switch channel down
}
}
if(CS == 3){
if(buttonState1 == 1){
menuState = 0;
}
}
//Channel Input Menu
while (menuState == 2){
int hundreds = 0;
int tens = 0;
int ones = 0;
CI = 1;
if(buttonState2 == 1){
CI = CI + 1;
if (CI = 5){
CI = 1;
}
while(CI == 1){
if(buttoState1 == 1
}
}
int buttonState2 = 0;
int buttonPin1 = 4;
int buttonPin2 = 6;
int power = 0;
int menuState = 0; //Channel Surf = 1, Channel input = 2, Volume = 3, Power = 4;
int displayState = 0; //Channel Surf = 1, Channel input = 2, Volume = 3, Power = 4;
int CS = 0; //Channel up = 1, Channel down = 2, Exit = 3
int CI = 0; //hundreds = 1, tens = 2, single = 3, Exit = 4
void setup(){
Serial.begin(9600);
}
void loop(){
buttonState1 = digitalRead(buttonPin1);
buttonState2 = digitalRead(buttonPin2);
if(power == 0){
if(buttonState1 == 1){
power = 1;
}
else if(buttonState2 == 1){
power = 1;
}
if(power == 1){
//transmit code to turn power on
displayState = 1;
}
buttonState1 = 0;
buttonState2 = 0;
}
if (power == 1){
//switch through main menu
if(menuState == 0){
if(displayState == 1){
//LCD Displays Channel Surf Menu
}
if(displayState == 2){
//LCD Displays Channel Input menu
}
if(displayState == 3){
//LCD Displays Volume Menu
}
if(displayState == 4){
//LCD Displays Power Menu
}
if(buttonState2 == 1){
displayState = displayState + 1;
if(displayState == 5){
displayState = 1;
}
}
}
//go into the menu (not just display)
if(buttonState1 = 1){
menuState = displayState;
}
//Channel Surf Menu
if (menuState == 1){
CS = 1;
if(buttonState2 == 1){
CS = CS+1;
if(CS == 4){
CS = 1;
}
}
if(CS == 1){
if(buttonState1 == 1){
//transmit code to switch channel up
}
}
if(CS == 2){
if(buttonState1 == 1){
//transmit code to switch channel down
}
}
if(CS == 3){
if(buttonState1 == 1){
menuState = 0;
}
}
//Channel Input Menu
while (menuState == 2){
int hundreds = 0;
int tens = 0;
int ones = 0;
CI = 1;
if(buttonState2 == 1){
CI = CI + 1;
if (CI = 5){
CI = 1;
}
while(CI == 1){
if(buttoState1 == 1
}
}
No comments:
Post a Comment