Salut ben tu peux te servir d'un port Analogique et y brancher un potentiométre, aprés tu peux directement prendre la valeur de la lecture du port analogique et l'intégrer dans un Delay....
Tu prends l'exemple de Tronixstuff (lien du tuto en anglais..), tu cables comme il le fait, tu branche comme ça ton potentiométre de 10K:
|--------- Arduino Analog 0
▼
+5V------[[[]]]-------GND
10K
Et tu up le sketch ci dessous, ou j'ai modifié le delay pour que se soit la valeur lut sur le pin Analogique 0:
/*
exercise 0.1 - KITT emulator!
Created 02/04/2010
By John Boxall
http://tronixstuff.wordpress.com...
http://wp.me/pQmjR-3i
Blinks LEDs from output pin 2~9 in a forwards<>backward motion
The circuit:
an LED is connected to each output pin from 2 to 8, thence to a 560 ohm resistor, then to ground (pin 4 on the bottom left of the Arduino Duemilanove).
based on an orginal by H. Barragan for the Wiring i/o board
*/
// The setup() method runs once, when the sketch starts
int del;
void setup()
{
// initialize the digital pins as outputs:
// later on there will be easier ways to do this
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
del= analogRead(0)
}
// the loop() method repeats indefinitely until you turn off the power
void loop()
{
digitalWrite(2, HIGH); // turn on LED on pin 2
delay(del); // wait (length determined by value of 'del')
digitalWrite(2, LOW); // turn it off
digitalWrite(3, HIGH); // turn on LED on pin 3
delay(del); // wait
digitalWrite(3, LOW); // turn it off
digitalWrite(4, HIGH); // turn on LED on pin 4
delay(del); // wait
digitalWrite(4, LOW); // turn it off
digitalWrite(5, HIGH); // turn on LED on pin 5
delay(del); // wait
digitalWrite(5, LOW); // turn it off
digitalWrite(6, HIGH); // turn on LED on pin 6
delay(del); // wait
digitalWrite(6, LOW); // turn it off
digitalWrite(7, HIGH); // turn on LED on pin 7
delay(del); // wait
digitalWrite(7, LOW); // turn it off
digitalWrite(8, HIGH); // turn on LED on pin 8
delay(del); // wait
digitalWrite(8, LOW); // turn it off
digitalWrite(9, HIGH); // turn on LED on pin 9
delay(del); // wait
digitalWrite(9, LOW); // turn it off
digitalWrite(8, HIGH); // turn on LED on pin 8
delay(del); // wait
digitalWrite(8, LOW); // turn it off
digitalWrite(7, HIGH); // turn on LED on pin 7
delay(del); // wait
digitalWrite(7, LOW); // turn it off
digitalWrite(6, HIGH); // turn on LED on pin 6
delay(del); // wait
digitalWrite(6, LOW); // turn it off
digitalWrite(5, HIGH); // turn on LED on pin 5
delay(del); // wait
digitalWrite(5, LOW); // turn it off
digitalWrite(4, HIGH); // turn on LED on pin 4
delay(del); // wait
digitalWrite(4, LOW); // turn it off
digitalWrite(3, HIGH); // turn on LED on pin 3
delay(del); // wait
digitalWrite(3, LOW); // turn it off
}
Vala A+