From e905be01b6072c6de8262d7bfcd7fff4031efd84 Mon Sep 17 00:00:00 2001 From: my name Date: Tue, 25 Aug 2026 03:39:54 +0200 Subject: [PATCH] blinking external led with psu technically works, but blinking incorrectly --- .../sketch_aug25b_rgbblink.ino | 43 +++++++++++++++++++ .../sketch_may4b_nerdtutorialscp.ino | 20 +++++++++ 2 files changed, 63 insertions(+) create mode 100644 sketch_aug25b_rgbblink/sketch_aug25b_rgbblink.ino create mode 100644 sketch_may4b_nerdtutorialscp/sketch_may4b_nerdtutorialscp.ino diff --git a/sketch_aug25b_rgbblink/sketch_aug25b_rgbblink.ino b/sketch_aug25b_rgbblink/sketch_aug25b_rgbblink.ino new file mode 100644 index 0000000..aae0827 --- /dev/null +++ b/sketch_aug25b_rgbblink/sketch_aug25b_rgbblink.ino @@ -0,0 +1,43 @@ +#include + +#define LED_PIN 15 +#define NUM_LEDS 5 + +CRGB leds[NUM_LEDS]; + +void setup() { + FastLED.addLeds(leds, NUM_LEDS); + FastLED.setBrightness(128); + FastLED.clear(true); +} + +// Helper: blink one LED with a color then turn it off +void blinkLED(int idx, CRGB color, int onMs = 300, int offMs = 150) { + if (idx < 0 || idx >= NUM_LEDS) return; + + leds[idx] = color; + FastLED.show(); + delay(onMs); + + leds[idx] = CRGB::Black; + FastLED.show(); + delay(offMs); +} + +void loop() { + // Make sure all LEDs start off + FastLED.clear(); + FastLED.show(); + + for (int i = 0; i < NUM_LEDS; i++) { + // R -> G -> B for this LED + blinkLED(i, CRGB::Red); + blinkLED(i, CRGB::Green); + blinkLED(i, CRGB::Blue); + + // Ensure it's off before moving on + leds[i] = CRGB::Black; + FastLED.show(); + delay(200); + } +} diff --git a/sketch_may4b_nerdtutorialscp/sketch_may4b_nerdtutorialscp.ino b/sketch_may4b_nerdtutorialscp/sketch_may4b_nerdtutorialscp.ino new file mode 100644 index 0000000..a32c5ec --- /dev/null +++ b/sketch_may4b_nerdtutorialscp/sketch_may4b_nerdtutorialscp.ino @@ -0,0 +1,20 @@ +#include + +#define LED_PIN 15 +#define NUM_LEDS 5 + +CRGB leds[NUM_LEDS]; + +void setup() { + + FastLED.addLeds(leds, NUM_LEDS); + +} + +void loop() { + + leds[0] = CRGB(255, 0, 0); + FastLED.show(); + delay(500); + leds[1] = CRGB(0, 255, 0); +} \ No newline at end of file