Help wanted on lighting project

Hi
I am very new to Arduino, but loving it
I am trying to create a multi level system for LED lighting. I will have 4 push-buttons wired to the Arduino, and when pressed they will light a corresponding LED through a digital out on the Arduino.
That outputs will also go through blocking diodes into potentiometers so as an output voltage between 0 and 5 can be set. This will then go into the AO input.
I am mapping this to the PWM pin 6 to give a corresponding dimming level
Upto this point all is working well, and the circuit responds as expected.
What i want to add is a fade between the levels. Direct on and to the level is too harsh, however i still want to retain the “straight PWM LED” as a reference .
I have included a LEDFader library from github, as i thought i would re purpose some existing code.
i set the LED to a value of 20 to start, and then reference the LEDValue to the outputValue, as there is already a level generated from that output.
I would very much appreciate any help at all, as i would love to be able to complete this project just using Arduino without the need for analogue electronics in the circuit.
here is my code

#include <LEDFader.h>

// set button and LED pin numbers:
const int buttonPin1 = 2;     
const int buttonPin2 = 3;
const int buttonPin3 = 4;
const int buttonPin4 = 5;
const int ledPin1 =  8;      // the number of the LED pin
const int ledPin2 =  9;
const int ledPin3 =  10;
const int ledPin4 =  12;

const int analogInPin = A1;  // analog in pin
const int analogOutPin = 6;  // PWM LED pin
LEDFader led = LEDFader (11); // fading led pin

int sensorValue = 0;
int outputValue = 0;
const int LEDValue = (25, 3000);  //fade to 25 over 3 seconds initally
// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // setup serial link
  Serial.begin(9600); 
  // initialize the LED pins as an outputs:
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  pinMode(ledPin4, OUTPUT);
  // initialize the pushbutton pins as an inpust: remember to have 10K to GND and button to 5V
  pinMode(buttonPin1, INPUT);
  pinMode(buttonPin2, INPUT);  
  pinMode(buttonPin3, INPUT);
  pinMode(buttonPin4, INPUT);
  // initial ouptput state Level 0
  digitalWrite(ledPin1, HIGH);
  // set fading led to a value over 2 seconds
  led.fade(LEDValue, 2000);
 
  
}

void loop(){
{
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin1);

  // check if the pushbutton 1 is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // turn LED 1 on:    
    digitalWrite(ledPin1, HIGH); 
    digitalWrite(ledPin2, LOW); 
    digitalWrite(ledPin3, LOW);
    digitalWrite(ledPin4, LOW);
  }
}
 {
   buttonState = digitalRead(buttonPin2);
   // check if the pushbutton 2 is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // turn LED 2 on:    
    digitalWrite(ledPin2, HIGH);
    digitalWrite(ledPin1, LOW);  
    digitalWrite(ledPin3, LOW);
    digitalWrite(ledPin4, LOW);
  } 
 }
  buttonState = digitalRead(buttonPin3);
   // check if the pushbutton 3 is pressed.
  // if it is, the buttonState is HIGH:
    if (buttonState == HIGH) {
     // turn LED 3 on:
     digitalWrite(ledPin3, HIGH);
     digitalWrite(ledPin1, LOW);
     digitalWrite(ledPin2, LOW);
     digitalWrite(ledPin4, LOW);
   }
{
    buttonState = digitalRead(buttonPin4);
     // check if the pushbutton 4 is pressed.
     // if it is, the buttonState is HIGH:
     if (buttonState == HIGH) {
       // turn LED 4 on:
       digitalWrite(ledPin4, HIGH);
       digitalWrite(ledPin1, LOW);
       digitalWrite(ledPin2, LOW);
       digitalWrite(ledPin3, LOW);
     }
{ 
   
  sensorValue = analogRead(analogInPin); // get value from the analog in pin             
  // map it to the range of the analog out:
  outputValue = map(sensorValue, 0, 1023, 0, 255); // 0 = off 865 is max as going through diodes so 5- 0.7 is 4.3 (860 + 5 for safety)
  LEDValue = outputValue;
  analogWrite(analogOutPin, outputValue);   // output outputValue to analogueOutPin
  Serial.print("sensor = " );               // read sensor in and output to serial        
  Serial.print(sensorValue);      
  Serial.print("\t output = ");             
  Serial.println(outputValue);   
  led.update ();
}
}

}
const int LEDValue = (25, 3000);  //fade to 25 over 3 seconds initally

No, that is not what that statement does. It invokes the comma operator, which is most definitely not doing what you expect/want.

  // set fading led to a value over 2 seconds
  led.fade(LEDValue, 2000);

From what to what?

Does that code even compile? You seem to have far too many curly braces.

// set fading led to a value over 2 seconds
  led.fade(LEDValue, 2000);

I wanted to have the LEDValue as the input from the A0 sensor, its already being used for the PWM output, so i thought instead of giving it a fixed value, i could replace it with a link to a value.

// set pin numbers:
const int buttonPin1 = 2;     // the number of the pushbutton pin
const int buttonPin2 = 3;
const int buttonPin3 = 4;
const int buttonPin4 = 5;
const int ledPin1 =  8;      // the number of the LED pin
const int ledPin2 =  9;
const int ledPin3 =  10;
const int ledPin4 =  11;

const int analogInPin = A1;  // analog in pin
const int analogOutPin = 6;  // PWM LED pin

int sensorValue = 0;
int outputValue = 0;

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // setup serial link
  Serial.begin(9600); 
  // initialize the LED pins as an outputs:
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  pinMode(ledPin4, OUTPUT);
  // initialize the pushbutton pins as an inpust: remember to have 10K to GND and button to 5V
  pinMode(buttonPin1, INPUT);
  pinMode(buttonPin2, INPUT);  
  pinMode(buttonPin3, INPUT);
  pinMode(buttonPin4, INPUT);
  // initial ouptput state Level 0
  digitalWrite(ledPin1, HIGH);
}

void loop(){{
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin1);

  // check if the pushbutton 1 is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // turn LED 1 on:    
    digitalWrite(ledPin1, HIGH); 
    digitalWrite(ledPin2, LOW); 
    digitalWrite(ledPin3, LOW);
    digitalWrite(ledPin4, LOW);
  }
}
 {
   buttonState = digitalRead(buttonPin2);
   // check if the pushbutton 2 is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // turn LED 2 on:    
    digitalWrite(ledPin2, HIGH);
    digitalWrite(ledPin1, LOW);  
    digitalWrite(ledPin3, LOW);
    digitalWrite(ledPin4, LOW);
  } 
 }
  buttonState = digitalRead(buttonPin3);
   // check if the pushbutton 3 is pressed.
  // if it is, the buttonState is HIGH:
    if (buttonState == HIGH) {
     // turn LED 3 on:
     digitalWrite(ledPin3, HIGH);
     digitalWrite(ledPin1, LOW);
     digitalWrite(ledPin2, LOW);
     digitalWrite(ledPin4, LOW);
   }
{
    buttonState = digitalRead(buttonPin4);
     // check if the pushbutton 4 is pressed.
     // if it is, the buttonState is HIGH:
     if (buttonState == HIGH) {
       // turn LED 4 on:
       digitalWrite(ledPin4, HIGH);
       digitalWrite(ledPin1, LOW);
       digitalWrite(ledPin2, LOW);
       digitalWrite(ledPin3, LOW);
     }
{   
  sensorValue = analogRead(analogInPin); // get value from the analog in pin             
  // map it to the range of the analog out:
  outputValue = map(sensorValue, 0, 865, 0, 255); // 0 = off 865 is max as going through diodes so 5- 0.7 is 4.3 (860 + 5 for safety)
  analogWrite(analogOutPin, outputValue);   // output outputValue to analogueOutPin
  Serial.print("sensor = " );               // read sensor in and output to serial        
  Serial.print(sensorValue);      
  Serial.print("\t output = ");             
  Serial.println(outputValue);   
}
}

}

This is my original complies and works ok, i just started to add the LED fade to it, i have tried it and it will not complie

sorry i should have said the A1 input. I just re read my code

i have tried it and it will not complie

I'm not in the mood for guessing games. Post the code and the errors.

Hi PaulS

The errors i m getting are

sketch_nov28a.ino:19: warning: left-hand operand of comma has no effect
sketch_nov28a.ino: In function ‘void loop()’:
sketch_nov28a:97: error: assignment of read-only variable ‘LEDValue’

when i use this code

#include <LEDFader.h>

// set button and LED pin numbers:
const int buttonPin1 = 2;     
const int buttonPin2 = 3;
const int buttonPin3 = 4;
const int buttonPin4 = 5;
const int ledPin1 =  8;      // the number of the LED pin
const int ledPin2 =  9;
const int ledPin3 =  10;
const int ledPin4 =  12;

const int analogInPin = A1;  // analog in pin
const int analogOutPin = 6;  // PWM LED pin
LEDFader led = LEDFader (11); // fading led pin

int sensorValue = 0;
int outputValue = 0;
const int LEDValue = (25, 3000);  //fade to 25 over 3 seconds initally
// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
  // setup serial link
  Serial.begin(9600); 
  // initialize the LED pins as an outputs:
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  pinMode(ledPin4, OUTPUT);
  // initialize the pushbutton pins as an inpust: remember to have 10K to GND and button to 5V
  pinMode(buttonPin1, INPUT);
  pinMode(buttonPin2, INPUT);  
  pinMode(buttonPin3, INPUT);
  pinMode(buttonPin4, INPUT);
  // initial ouptput state Level 0
  digitalWrite(ledPin1, HIGH);
  // set fading led to a value over 2 seconds
  led.fade(LEDValue, 2000);
 
  
}

void loop(){
{
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin1);

  // check if the pushbutton 1 is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // turn LED 1 on:    
    digitalWrite(ledPin1, HIGH); 
    digitalWrite(ledPin2, LOW); 
    digitalWrite(ledPin3, LOW);
    digitalWrite(ledPin4, LOW);
  }
}
 {
   buttonState = digitalRead(buttonPin2);
   // check if the pushbutton 2 is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // turn LED 2 on:    
    digitalWrite(ledPin2, HIGH);
    digitalWrite(ledPin1, LOW);  
    digitalWrite(ledPin3, LOW);
    digitalWrite(ledPin4, LOW);
  } 
 }
  buttonState = digitalRead(buttonPin3);
   // check if the pushbutton 3 is pressed.
  // if it is, the buttonState is HIGH:
    if (buttonState == HIGH) {
     // turn LED 3 on:
     digitalWrite(ledPin3, HIGH);
     digitalWrite(ledPin1, LOW);
     digitalWrite(ledPin2, LOW);
     digitalWrite(ledPin4, LOW);
   }
{
    buttonState = digitalRead(buttonPin4);
     // check if the pushbutton 4 is pressed.
     // if it is, the buttonState is HIGH:
     if (buttonState == HIGH) {
       // turn LED 4 on:
       digitalWrite(ledPin4, HIGH);
       digitalWrite(ledPin1, LOW);
       digitalWrite(ledPin2, LOW);
       digitalWrite(ledPin3, LOW);
     }
{ 
   
  sensorValue = analogRead(analogInPin); // get value from the analog in pin             
  // map it to the range of the analog out:
  outputValue = map(sensorValue, 0, 1023, 0, 255); // 0 = off 865 is max as going through diodes so 5- 0.7 is 4.3 (860 + 5 for safety)
  LEDValue = outputValue;
  analogWrite(analogOutPin, outputValue);   // output outputValue to analogueOutPin
  Serial.print("sensor = " );               // read sensor in and output to serial        
  Serial.print(sensorValue);      
  Serial.print("\t output = ");             
  Serial.println(outputValue);   
  led.update ();
}
}

}
  LEDValue = outputValue;

You have declared it constant and you can't alter the value of a constant variable ,remove constant from where this variable is declared and this will remove following error:

sketch_nov28a.ino: In function 'void loop()': sketch_nov28a:97: error: assignment of read-only variable 'LEDValue'

about this:

sketch_nov28a.ino:19: warning: left-hand operand of comma has no effect

You get it here:

const int LEDValue = (25, 3000);  //fade to 25 over 3 seconds initally

You have to provide a conditional (like &&,||,!=,==)and you are using a comma.