Proof of Concept

Well I jumped in the deep end with this one.

I am trying to write a program for a proof of concept for an air ride controller to be put in a vehicle.
I want the first button to control between 2 different operational modes; the first one being a potentiometer, the second being preset values being selected by different buttons.
These will use IR distance meters to monitor the distance from the frame to the axle and control valves to open or release air from the air bags.

For the proof of concept I setup a circuit with LED’s that represent the air bags and photo cells for the IR distance sensors.
I have never done any coding like this before and I am fairly lost, I have done a lot of the exercises that I can find online but to no avail to help me figure this out.
Most of the trouble for me seems to be with the 3 preset value buttons, I want an interlock so that if two or more are pushed it will ignore the all but the first one pushed. Also mapping the buttons to set the brightness of the LED’s.

I will try and attach a file of the circuit in case that helps or if anyone has suggestions of an easier or better way for the hardware to be set up, although it will probably look like a jumbled mess.

Without your code we are unable to help, as we're not mindreaders.

as we're not mindreaders.

I knew you were going to say that. 8)

although it will probably look like a jumbled mess

Indeed, but you could always try a circuit diagram....

The only part of the code I have written is defining the variables, because everytime I start it i realize that way is not going to work.
Sorry didn’t think about putting up a circuit diagram but I attached one here.

Break the project down into stages rather than tackling it all at once. You know how to read buttons (I presume). Write a program such that when a button is pressed it switches a variable, let's call it systemState, between 2 states and prints the state on the Serial monitor.

HINT - there is an example of detecting a state change in the IDE. Does the program behave as expected or are there sometimes random changes, or no changes, when the button is pressed ? What could be the cause ? Do you need to debounce the button input ? Maybe there is an example of debouncing in the IDE or you could research it online as it is a common requirement......

When this program works reliably you can move on to make it react to the change of state.

I have been able to do all the individual components of the circuit except for mapping the value to be sent to the LED, I had expected to have to put the debounce in it
Could I bother someone to write a sketch for this diagram where the pot sets the expected value to be seen from the photoresistor and adjusts the value sent to the LED to achieve that.

Capture ex.PNG

Something along these line maybe

const byte ledPin = 11;
const byte potPin = 5;
const byte ldResistor = 0;

void setup() 
  pinMode(ledPin, OUTPUT);

void loop() 
  for (int outputVal = 0; outputVal < 256; outputVal++)
    analogWrite(ledPin, outputVal);
    if (analogRead(ldResistor) >= analogRead(potPin))

Assuming that I have got this even nearly right there are some snags that I foresee :
How long does the LDR take to react to light changes ? Too long and the LED will overshoot the correct value.
The LED will constantly go back to zero output and ramp up until its output triggers the for loop to stop. Mind you, it will repeat the loop pretty quickly so this might not matter.

A better, but more complicated approach would be to compare the readings from the LDR and the pot and ramp the LED brightness up or down from its current value as appropriate .