Go Down

Topic: Scrolling Option (Read 716 times) previous topic - next topic


A project that I am starting will have a Parallax 4 x 20 serial LCD. What I am wanting to do is program a a kindof scrolling menu with 3 buttons. One to scroll up, another to scroll down, and the last to select the option that is printed on the LCD.  I don't really know where to start on how to program  this, but if anyone give some advice or insight it will be greatly appreciated.  Thanks.


Jul 03, 2014, 05:34 pm Last Edit: Jul 03, 2014, 05:36 pm by alleniiij678 Reason: 1
Thanks for the links,  I changed up my design some just to play around with. Right now instead of using 2 buttons to scroll I have a  0-9 dual pushwheel switch to dial through. I still want to put in a button to select the showing option but I'm still working on it.  I also have it all hooked up to the LCD.  Here is a copy of the code I have now, its a lot and a little messy but I'm learning. If I decide to not include the 3rd button I might just put a delay on what I want to happen.
Code: [Select]
const int led1 = 4;
const int led2 = 5;
const int led3 = 6;
const int led4 = 7;
const int sw1 = 13;
const int sw2 = 12;
const int sw3 = 11;
const int sw4 = 10;
const int lcd = 1;
int val1 = 0;
int val2 = 0;
int val3 = 0;
int val4 = 0;

void setup(){
 pinMode(lcd,OUTPUT);Serial.write(12);Serial.write(131);Serial.write("The Bartender");
void loop(){
 val1 = digitalRead(sw1);
 val2 = digitalRead(sw2);
 val3 = digitalRead(sw3);
 val4 = digitalRead(sw4);
 if(val1 == HIGH){digitalWrite(led1,HIGH);Serial.write(168);Serial.write("Opt 1");} // led 1 on, print opt 1 on screen
 if(val2 == HIGH){digitalWrite(led2,HIGH);Serial.write(173);Serial.write("Opt 2");} // led 2 on, print opt 2 on screen
 if(val3 == HIGH){digitalWrite(led3,HIGH);Serial.write(178);Serial.write("Opt 3");} // led 3 on, print opt 3 on screen
 if(val4 == HIGH){digitalWrite(led4,HIGH);Serial.write(183);Serial.write("Opt 4");} // led 4 on, print opt 4 on screen
 if(val1 == LOW){digitalWrite(led1,LOW);Serial.write(168);Serial.write("     ");} // led 1 off, print *blank* on screen
 if(val2 == LOW){digitalWrite(led2,LOW);Serial.write(173);Serial.write("     ");} // led 2 off, print *blank* on screen
 if(val3 == LOW){digitalWrite(led3,LOW);Serial.write(178);Serial.write("     ");} // led 2 off, print *blank* on screen
 if(val4 == LOW){digitalWrite(led4,LOW);Serial.write(183);Serial.write("     ");} // led 2 off, print *blank* on screen


I am trying to do understand what u r trying here,

Here your judging on status  pin. when you checking status High or loW.
Assume you said
1) problem statement from your code
Code: [Select]

do this...................
}else // means your selected pin is low , so dont use multiple if statement so it take long time to check condition

Which ur writing end of code

2) problem statement.
you should know what is condition of other pin when particular pin set high or Low.


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131