Example/Help with using buttons to change variable values

I have a project that I would like to deploy, however I would like to update some variables in order to tweak it while using w/o connecting to a PC to upload the change. This is my first project and I haven't found a example of how to do this to help me figure it out.

Plan is to kick off a "set up mode" when 2 buttons are pushed during one of the loops.
Once in this set-up mode LCD would display the variables one at a time and I would move the the next variable or change up or down and update the variable.

Once updated these variables would remain till power is removed or the device is reset.

Basic Hardware set-up:
Using the micro controller
Project using 4 push button using INPUT_PULLUP using Ground and pin D3-D6
Servo using Pin D2
1602 LCD using the IIC/I2C interface using pin A4/A5 Ground and 5v

I would like to get to the set-up function when two buttons are pressed at the same time (get to a set-up screen for example)

Change one variable from a value between either 0 or 1
Change another variable between 1 thru 10 then loop back to 1

Any examples where you use buttons to change a variable would be helpful. I've found using serial updates which I think is going down the path. Examples are great as I learn better by reverse engineering what others have done.

My kids are helping... I love seeing them think out loud on ideas they have. Creative juices flowing is never a bad thing.

I would like to get to the set-up function when two buttons are pressed at the same time

So, what is the problem?

You have some code you haven't shown. You have some switches connected, somewhere, somehow. You can't expect help with your code when you haven't shown anything.

Search for "Arduino button library".

Instead of buttons you might like to consider an Android device as your control centre/dashboard.

Not as challenging as you might at first imagine.

The problem is I have never done it, which isn't much of a problem more like a challenge. Just looking for an example to reverse engineer a solution into my project. I have no code trying this yet just looking for a few examples and then work it into my code.

I have 4 push buttons and during one of the loops only 2 of the 4 buttons are being used. This is my thinking why pushing the other two would be good to kick off a variable setup and less chance to accidentally kick this off. LCD show current variable and up/down and save the change type logic, do this for two variables then back to the original code. Getting the 2 buttons to kick off this isn't a problem. Just taking existing value and increment up/down then saving the new variable.

I'm thinking the Android solution might be worth a thought... I would like to keep this on the LCD so I don't need to have my tablet with me (using this on a boat to control the trolling motor) but might be worth playing around with it to make even more challenging variable updates quickly.

Sorry if it takes me a bit to get back to the forum. I farm on the side and almost go time for spring planting season where several new items we are doing final set-up and testing before we get a chance to get into the field which adds to the stress this time of year where it doesn't look like a big window for planting will exist at this point. I see lots of uses for Microcontrollers at the farm to... Just found last night 2 electric valves which might be a automation project on loading micro-nutrients into the sprayer for next season with data being fed by the scale on product removed from the drum.

Well disregard this question... No different then moving a servo with a button.

Side note for part of my code I'm using VarSpeedServo and it was moving to 90 degrees on the servo at start up (not good for controlling a throttle). I changed the value from 1500 to 775 to match up with my initial servo position. VarSpeedServo.h changed the following.
#define DEFAULT_PULSE_WIDTH 775 //1500

Follow up if any help to others.

Things I learned that would have saved me some development time.

Servo's: Really look at using code to send microseconds instead of degrees if your looking to have as much precision as possible. You can set-up a variable to match the dead zone of your servo for example. If you swap servos you can verify and change the dead zone (mine was 4 microseconds for example). Sometimes the basic examples make things too easy and you don't learn the fundamentals of what the library is doing.

Also on servo's Speed Kills... No problem driving a RC size servo if you slow it down even using USB for power thru the arduino. My project I didn't want fast movement of the servo. Save the current and the goto location for the servo then move +1 x microseconds(Dead band variable) then verify you still need to move again till completed along with a variable for the short delay. Using microseconds and this add a lot of code, but quick copy/paste and adds a really smooth actuating servo for more precise work.

Delay between moving servo I went with 20 for a starting point.

On the setup function: In my main loop I only needed 2 buttons for that code, but added the other two in order to control aspects of that loop for different options to turn on and off for one and to adj the max speed allowed for the other. When I press the main button it loops back to the start with the saved start value and new max that was set and 0/1 (true false) if an options should be used or not.

Thanks for those who posted to this. I was making it much harder then it really was. Hate to guess how many lines of code this project is on, but I have a inboard carb to modify because another fisherman loved how good my project works he wants me to do this for his rig. Now if I only had lots of down time between farming, IT work, Fishing, Hunting and Family time. :wink: Need a 10 day week...

Just shy of 700 lines of code for my first project and works better then expected. Now to make a more professional waterproof case for it this winter. Always something to improve.