Here's a possible scheme for 2 LEDs that is easily extended to any number of LEDs. [WARNING: untested code!]
const int numLeds = 2;
const int ledPins[numLeds] = { 2, 3 }; // the number of the LED pin
int ledStates[numLeds] = { LOW, LOW }; // ledState used to set the LED
long previousMillis[numLeds] = { 0, 0 }; // will store last time LED was updated
float multipliers[numLeds] = { 0.5, 1.0 }; // the blink rates
int sensorPin = A0; // select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor
long interval = sensorValue; // interval at which to blink (milliseconds)
void setup() {
unsigned long currentMillis = millis();
for (int i = 0; i < numLeds; ++i) {
pinMode(ledPins[i], OUTPUT);
previousMillis[i] = currentMillis;
}
}
void loop()
{
sensorValue = analogRead(sensorPin);
unsigned long currentMillis = millis();
for (int i = 0; i < numLeds ; ++i)
{
unsigned long target = (unsigned long)(sensorValue * multipliers[i]);
if(currentMillis - previousMillis[i] >= target) {
previousMillis[i] += target;
if (ledStates[i] == LOW)
ledStates[i] = HIGH;
else
ledStates[i] = LOW;
digitalWrite(ledPins[i], ledStates[i]);
}
}
}