meta données pour cette page
int sensorPin = A0; // select the input pin for the potentiometer int sensorValue = 0; // variable to store the value coming from the sensor int timer = 50; int lowPin = 6; int highPin = 13; void setup() { // declare the ledPin as an OUTPUT: for (int thisPin = 6; thisPin < 14; thisPin++) { pinMode(thisPin, OUTPUT); } } void loop() { // read the value from the sensor: sensorValue = analogRead(sensorPin); if (sensorValue < 700){ chaserUp(); } else { chaserDown(); } } void chaserUp(){ for (int thisPin = lowPin; thisPin <= highPin; thisPin++) { // turn the pin on: digitalWrite(thisPin, HIGH); delay(timer); // turn the pin off: digitalWrite(thisPin, LOW); } } void chaserDown(){ for (int thisPin = highPin; thisPin >= lowPin; thisPin--) { // turn the pin on: digitalWrite(thisPin, HIGH); delay(timer); // turn the pin off: digitalWrite(thisPin, LOW); } }