Help, I need wisdom!

Hi, My name is Bruno, and i have recently started a new project for my Photography Hobby.
It will be a simple slider controlled by an arduino for time-lapses, sure I could get one already made or a Kit but it will be less fun so i decide to build my own custom made slider.
After toying with steppers and allot of planning to see what function it will have, I finally started to put some code together.
For now I am just building an simple example that sets up a screen, reads three buttons and displays a value stored in a variable, later this example will be use as base for completing the rest.

My knowledge of programming is very basic and most self taught, so her i ask for help because I am having trouble displaying the value that i want.
So basically goes like this after the introduction, it should read the select button and store the number of times that it was pressed, then it will call different functions based on the number of times pressed.
right now it only registers one time the select button and then calls a function, in the function reads the up button and ads 1 or the down button a takes 1 then it should display the result
here is the main program

#include <LiquidCrystal.h>
#include <Button.h>

LiquidCrystal lcd(12,11,5,4,3,2);
Button Select=Button(8,BUTTON_PULLDOWN);
Button Up=Button(9,BUTTON_PULLDOWN);
Button Down=Button(10,BUTTON_PULLDOWN);

int posCursor=0;
int Exposure=0;
void setup (){

lcd.print("V 1.0");

void loop() {

case 1:
 if (posCursor=1){

//case 2:
//if (posCursor=2){
//  posCursor=0;



and here is the function that reads up and down

int exposureTime(){

     if(Up.isPressed()){ //reads up button
      if(Down.isPressed()){//reads down button
//    while(posCursor=1);

the other functions seems to work and the screen stays like this

|Timelapse Type: |
|Exposure: | it should display the value after Exposure and it should change with up
| | or down

I could go with a menu but i could not figure it out how to do it and i want to preset all the values on the screen and then press start to make the stepper work.

I am almost sure that it is something simple but my knowledge is limited (i paint cars for a living) so i ask for your help.

Use the MODIFY button to edit your post. Highlight your code and click the “<>” button to the left of the QUOTES dialog cloud, then click save.

Done Thanks, any ideas how to solve my problem??

Post the whole program - attach it if it’s too big to fit in a post.

The Thread stepper motor basics may be useful.

There is a neat way for detecting button presses here.

I must say, if this were my project, I would leave the LCD stuff until I had everything else working. Or, perhaps, figure out the LCD stuff and then put it aside while you work on the other parts. Leaving it out makes the code much shorter and easier to debug.


Take a look at this.

and this.

and buttonstate change detection

and arduino SWITCH.

and ARDUINO button tutorialthread might help.

Thank you Thank you Thank you raschemmel, I took a look at your tips and got my problem solved with that thread about the buttons, turns out using the Buttons.h library was not working good for me, gotta keep things simple :) now I can continue developing my screens and when the rest of the hardware arrives I can finally start to put all together. thank you once again.

No problem. Glad to hear you got it worked out. If you have any more questions don't hesitate to ask. We're "THE FORUM" , (we're here 24/7/365. we NEVER close)...

Never close - may have long delays between responses due to time zone differences, work schedules, occasional need to sleep ...

raschemmel: Take a look at this. and this. and this. and this. and this thread might help.

It would be a big help for the rest of us if you would add a few words describing your links so we don't have to open them to figure out what they are.


It was for the OP. (and it worked for him) but I changed it JUST for you.

raschemmel: but I changed it JUST for you.

Seriously, I do appreciate it. Thanks

And, as you imply, I do expect the OP to read them regardless.