if these 3 steps are true, just combine what's given
the hints grumpy gave already.
and then you might come up with something like
const int adcPin = A1;
//const int led [] = {23, 22, 21, 20, 19, 18, 17, 16, 15, 14};
const int led [] = {3, 5, 6, 9, 10, 11, 3, 5, 6, 9}; // on UNO only 3, 5, 6, 9, 10 und 11.
const byte numberOfLeds = 10;
byte ledState = LOW; // ledState used to set the LED
unsigned long previousMillis = 0; // will store last time LED was updated
const long interval = 1000; // interval at which to blink (milliseconds)
const int adcResolution = 1024;
const int pwmResolution = 256;
void setup()
{
Serial.begin(115200);
Serial.println(F("Blink Without Delay PWM LEDs"));
for (byte i; i < numberOfLeds; i++) {
pinMode(led[i], OUTPUT);
}
pinMode(adcPin, INPUT);
}
void loop()
{
//read a potentionemter
int adc = analogRead(adcPin);
//Blink a LED (or many LEDs) between dark and the calculated PWM value
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
// save the last time you blinked the LED
previousMillis = currentMillis;
// if the LED is off turn it on and vice-versa:
int pwmToSet = 0;
if (ledState == LOW) {
ledState = HIGH;
//set a PWM Value to the given ADC Read out
pwmToSet = map(adc, 0, adcResolution - 1, 0, pwmResolution - 1);
Serial.print(F("adc=")); Serial.print(adc);
Serial.print(F(" pwmToSet=")); Serial.println(pwmToSet);
} else {
ledState = LOW;
Serial.println(F("all LEDs off"));
}
// set the LED with the ledState of the variable:
for (byte i = 0; i < numberOfLeds; i++) {
//digitalWrite(led[i], ledState); // no we don't want to write on, off any more
analogWrite(led[i], pwmToSet);
}
}
}
This code is non optimized in any way, to keep it as consistent with the existing examples as possible.
If you don't understand a line - asking is still allowed after you have checked the examples and Google.
You will even find the 3 lines of "feature requests" as comments in the code. This is to show you how to elaborate a "program". Define what's wanted, bring it in an order and finally code it. If you are not good in coding - try to reuse as many examples as possible. The IDE comes with tons of examples for you.