From 24012ae623bd61cf7297f883d8248b88f6152acf Mon Sep 17 00:00:00 2001 From: gbrochar Date: Fri, 13 May 2022 20:13:16 +0200 Subject: [PATCH] first test --- Blink/Blink.ino | 124 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 Blink/Blink.ino diff --git a/Blink/Blink.ino b/Blink/Blink.ino new file mode 100644 index 0000000..a0f48ce --- /dev/null +++ b/Blink/Blink.ino @@ -0,0 +1,124 @@ +#include + +// How many leds in your strip? +#define NUM_LEDS 100 + +// For led chips like WS2812, which have a data line, ground, and power, you just +// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock, +// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN +// Clock pin only needed for SPI based chipsets when not using hardware SPI +#define DATA_PIN 5 +#define CLOCK_PIN 13 +int fc; +float t; +// Define the array of leds +CRGB leds[NUM_LEDS]; + +void setup() { + // Uncomment/edit one of the following lines for your leds arrangement. + // ## Clockless types ## + //FastLED.addLeds(leds, NUM_LEDS); // GRB ordering is assumed + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); // GRB ordering is typical + // FastLED.addLeds(leds, NUM_LEDS); // GRB ordering is typical + // FastLED.addLeds(leds, NUM_LEDS); // GRB ordering is typical + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); // GRB ordering is typical + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // ## Clocked (SPI) types ## + // FastLED.addLeds(leds, NUM_LEDS); // GRB ordering is typical + // FastLED.addLeds(leds, NUM_LEDS); // GRB ordering is typical + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); + // FastLED.addLeds(leds, NUM_LEDS); // BGR ordering is typical + // FastLED.addLeds(leds, NUM_LEDS); // BGR ordering is typical + // FastLED.addLeds(leds, NUM_LEDS); // BGR ordering is typical + // FastLED.addLeds(leds, NUM_LEDS); // BGR ordering is typical +} + +void loop() +{ + t = float(millis()) * .; + for (int i = 0; i < 100; i++) + leds[i] = CRGB::Black; + + +//une autre forme +// +// for (int i = 0; i < 100; i++) +// { +// float tt = float(t)/10.; +// int j = 100 - i; +// int test = (i + t / 2) % 89- ((i + t / 2) % 89) % 3; +// if(test == 0) +// { +// leds[i] = CRGB::CRGB(255, i, 0); +// } +// test = (i + t / 6) % 76- ((i + t / 2) % 76) % 3; +// if(test == 0) +// { +// leds[j] = CRGB::CRGB(0, 255, (.7+.5*sin(float(j)/14.666 + tt)) * 128); +// } +// +// +// test = (i + t / 1) % 43- ((i + t / 1) % 7643) % 3; +// if(test == 0) +// { +// leds[j] = CRGB::CRGB(0, 255, (.7+.5*sin(float(j)/14.666 + tt)) * 128); +// } +// +// test = (i + t / 2) % 34- ((i + t / 2) % 34) % 3; +// if(test == 0) +// { +// leds[j] = CRGB::CRGB((0.7+.5*cos(float(i)/14.666 + tt)) * 128, 0, 255); +// } +// test = (i + t / 3) % 89- ((i + t / 3) % 89) % 6; +// +// if (test == 43) +// { +// leds[i] = CRGB::CRGB(i * 2.5,0,255); +// } +// } + + leds[100 - int(t / 2.27) / 64 % 100] = CRGB::CRGB(128, 128, 0); + leds[int(t / 1.37) / 64 % 100] = CRGB::CRGB(0, 128, 128); + leds[100 - int(t / 1.97) / 64 % 100] = CRGB::CRGB(128, 0, 128); + + leds[int(t / 2.7) / 128 % 100] = CRGB::CRGB(128, 64, 64); + leds[100 - int(t / 3.27) / 128 % 100] = CRGB::CRGB(64, 128, 64); + leds[int(t / 1.47) / 128 % 100] = CRGB::CRGB(64, 64, 128); + leds[100 - int(t / 2.27) / 128 % 100] = CRGB::CRGB(96, 96, 64); + leds[int(t / 1.37) / 128 % 100] = CRGB::CRGB(96, 64, 96); + leds[100 - int(t / 1.97) / 128 % 100] = CRGB::CRGB(64, 96, 96); + + leds[int(t / 1.7) / 64 % 100] = CRGB::CRGB(255, 0, 0); + leds[100 - int(t / 1.27) / 64 % 100] = CRGB::CRGB(0, 255, 0); + leds[int(t / 1.47) / 64 % 100] = CRGB::CRGB(0, 0, 255); + + // leds[57 + count] + FastLED.show(); + delay(4); + // Now turn the LED off, then pause +}