Problems with multiples inputs/outputs

Hi Everyone...well this is a very nice forum...congrats... i have a problem... i work with arduino and processing...pd... and works fine... but yesterday i worked just with arduino... a little program to control of blink of leds... yes ... the example... but only works with 1 potentiometer and one led... i want control two or more blinking leds with independent spedd delay and independent potentiometer... i can printed the independent values of pot, but ever the pot a influenced the pot b... i am thinking in this program:

int potPin = 1;
int potPin2 = 2;

int ledPin = 6; //
int ledPin2 = 11; //
int val1 = 0;
int val2 = 0;

void setup() {

pinMode(ledPin, OUTPUT); //
pinMode(ledPin2, OUTPUT); //
Serial.begin(9600); //
Serial.println("hi forum");

}

void loop() {

val1 = analogRead(potPin); //
// --
//
Serial.print(" 1: "); //
Serial.print(val1, DEC); //
Serial.print("\r\n"); //
// --
digitalWrite(ledPin, HIGH);

delay(val1); //
digitalWrite(ledPin, LOW); //
delay(val1);

val2 = analogRead(potPin2); //
Serial.print(" 2: "); //
Serial.print(val2, DEC); //
Serial.print("\r\n"); //
digitalWrite(ledPin2, HIGH); //

delay(val2);
digitalWrite(ledPin2, LOW);
//
delay(val2);
}

Thanks a lot...

Best regards

Bot

Was there a question somewhere that I missed?

If you want independant control you can not use delay().

Take a look here if you want help with 'multitasking': Arduino Playground - GeneralCodeLibrary

If you want to do it without using a library, read and understand this:

:]

Thanks brothers.... really... i am not native english speaker....

Best regards...

Mmmm, not work... i create a new program who controls 2 led blink, with variable time, i can connected 2 leds, but always the pots controlling the two leds... not independent...but in consola are independent i attached a demo, two leds, two pots... can you help me? is possible?

int sensorPin = 0;
const int ledPin = 13;
int sensorValue = 0;
int ledState = LOW;
long previousMillis = 0;

int sensorPina = 1;
const int ledPina = 12;
int sensorValuea = 0;
int ledStatea = LOW;
long previousMillisa = 0;

void setup() {
// declare the ledPin as an OUTPUT:
pinMode(ledPin, OUTPUT);
pinMode(ledPina, OUTPUT);
Serial.begin(9600);
Serial.println("Helloworld");

}

void loop() {
sensorValue = analogRead(sensorPin);
Serial.print(" 1: ");
Serial.print(sensorValue, DEC);
Serial.print("\r\n");
// read the value from the sensor:
if (millis() - previousMillis > sensorValue) {

previousMillis = millis();

if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;

digitalWrite(ledPin, ledState);
}
sensorValuea = analogRead(sensorPina);
Serial.print(" 2: ");
Serial.print(sensorValuea, DEC);
Serial.print("\r\n");

if (millis() - previousMillisa > sensorValuea) {

previousMillisa = millis();

if (ledStatea == LOW)
ledStatea = HIGH;
else
ledStatea = LOW;

digitalWrite(ledPina, ledStatea);
}
}

Best regards

Ardu