From e5a0814bd83461c572418e474fbdec0d671eb007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Jaton?= <33033910+gaeljaton@users.noreply.github.com> Date: Sat, 3 Jul 2021 02:42:38 +0200 Subject: [PATCH] Add files via upload --- .../t36sequenceur4pistesAimants.ino | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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); }