Page 1 sur 1

de l'aide pour un code ardino (3eme feux stop voiture)

Posté : jeu. 9 juin 2022 23:09
par fred342007
bonjour et merci de me lire
j'ai fait un programme pour que mon 3eme feux stop clignote un peut comme k2000
mon problème et que je voudrais que mon Arduino s'allume avec un + après contact
qu'il soit connecter a la prise de mon feux
et que quand il reçois du 12v sur une de ces entrer il démarre mon code
j'espère me faire comprendre

merci a tous

mon code //

int pinsCount=5; // declaring the integer variable pinsCount
int pins[] = {2,3,4,5,6,}; // declaring the array pins[]

void setup() {
for (int i=0; i<pinsCount; i=i+1){ // counting the variable i from 0 to 9
pinMode(pins, OUTPUT); // initialising the pin at index i of the array of pins as OUTPUT
}
}

void loop() {
for (int i=0; i<pinsCount; i=i+1){ // chasing right
digitalWrite(pins, LOW); // switching the LED at index i on
delay(100); // stopping the program for 100 milliseconds
digitalWrite(pins, HIGH); // switching the LED at index i off
}
for (int i=pinsCount-0; i>0; i=i-1){ // chasing left (except the outer leds)
digitalWrite(pins, HIGH); // switching the LED at index i on
delay(150); // stopping the program for 100 milliseconds
digitalWrite(pins, LOW); // switching the LED at index i off
}
}