diff --git a/developpement_electronique/t36sequenceur4pistesAimants/t36sequenceur4pistesAimants.ino b/developpement_electronique/t36sequenceur4pistesAimants/t36sequenceur4pistesAimants.ino index dcbb852..f782040 100644 --- a/developpement_electronique/t36sequenceur4pistesAimants/t36sequenceur4pistesAimants.ino +++ b/developpement_electronique/t36sequenceur4pistesAimants/t36sequenceur4pistesAimants.ino @@ -1,5 +1,6 @@ #define bounceTime 20 - +#include +CRGB leds[8]; #include #include #include @@ -30,6 +31,7 @@ unsigned long previousMillis; int tInt; void setup() { + FastLED.addLeds(leds, 8); AudioMemory(20); pinMode(13, OUTPUT); for (int i = 0; i < 8; i++) { @@ -58,6 +60,12 @@ void setup() { } void loop() { tInt = map(analogRead(A9), 0, 1023, 64, 1000); + if (millis() >= previousMillis + tInt*0.33) { + for (int i = 0; i < 8; i++) { + leds[i] = 0; + } + FastLED.show(); + } if (millis() >= previousMillis + tInt) { previousMillis = millis(); if (!digitalRead(pinLine[0])) { @@ -75,7 +83,10 @@ void loop() { for (int i = 0; i < 8; i++) { pinMode(pinStep[i], OUTPUT); digitalWrite(pinStep[i], HIGH); + leds[i] = 0; } + leds[7-Step] = 255; + FastLED.show(); Step = (Step + 1) % 8; digitalWrite(pinStep[Step], LOW); }