From c7405d680065156cb21ca1a752e06d8ddea15656 Mon Sep 17 00:00:00 2001 From: der-programmer1 Date: Thu, 23 Oct 2025 15:57:33 +0200 Subject: [PATCH 01/18] Create First_Led_Code.txt --- First_Led_Code.txt | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 First_Led_Code.txt diff --git a/First_Led_Code.txt b/First_Led_Code.txt new file mode 100644 index 0000000..9c0d706 --- /dev/null +++ b/First_Led_Code.txt @@ -0,0 +1,36 @@ + // You tell the Arduino, that there is something on the following Pins: + +const int LedOnePin = 3; // Led on Pin 3 +const int LedTwoPin = 6; // Led on Pin 6 +const int LedThreePin = 9; // Led on Pin 9 + +void setup() { + // Now you tell the Arduino, that he should give our LED's (Pin 3, 6, 9) Power. + + pinMode(LedOnePin, OUTPUT); + pinMode(LedTwoPin, OUTPUT); + pinMode(LedThreePin, OUTPUT); +} + +void loop() { + +int onTime = 500 // the onTime for the Led now is 0,5 seconds long +int offTime = 500 // the offTime for the Led now is 0,5 seconds long + +digitalWrite(LedOnePin, HIGH); // Led one has now HIGH Power (5V) +delay(500); // It is on for 0,5 seconds +digitalWrite(LedOnePin, LOW); // Power is LOW (0V) +delay(500); // offTime = 0,5 seconds + + +digitalWrite(LedTwoPin, HIGH); // Led two has now HIGH Power (5V) +delay(500); // It is on for 0,5 seconds +digitalWrite(LedTwoPin, LOW); // Power is LOW (0V) +delay(500); // offTime = 0,5 seconds + +digitalWrite(LedThreePin, HIGH); // Led three has now HIGH Power (5V) +delay(500); // It is on for 0,5 seconds +digitalWrite(LedThreePin, LOW); // Power is LOW (0V) +delay(500); // offTime = 0,5 seconds + +} From effa7db7a289f204907928639ae96be28f06a8dd Mon Sep 17 00:00:00 2001 From: der-programmer1 Date: Thu, 23 Oct 2025 16:33:26 +0200 Subject: [PATCH 02/18] Add LED control with random timing and repetition logic Implement LED control logic with random selection and repetition handling. --- For the advanced | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 For the advanced diff --git a/For the advanced b/For the advanced new file mode 100644 index 0000000..3005075 --- /dev/null +++ b/For the advanced @@ -0,0 +1,45 @@ +// Array containing the digital pins where the LEDs are connected +const int leds[] = {3, 6, 9}; + +// Variable to store which LED was last turned on (-1 = none yet) +int letzteLED = -1; + +// Counter to track how many times the same LED has been selected consecutively +int zaehler = 0; + +void setup() { + // Initialize the random number generator using analog noise from pin A0 + randomSeed(analogRead(A0)); + + // Set each LED pin as an OUTPUT + for (int i = 0; i < 3; i++) pinMode(leds[i], OUTPUT); +} + +void loop() { + // Determine which LED to activate next: + // - If the same LED has been selected 3 or more times in a row, + // a more complex random logic is used to reduce repetition. + // - Otherwise, a simple random selection from 0 to 2 is made. + // NOTE: This logic is compact but somewhat hard to read and could lead to uneven probability distribution. + int led = (zaehler >= 3) ? (random(0, 3 - (letzteLED == 2)) + (letzteLED == 0)) : random(0, 3); + + // Check if the same LED was selected again: + // - If yes, increment the repetition counter. + // - If not, reset the counter and update the "last LED" tracker. + if (led == letzteLED) zaehler++; else { letzteLED = led; zaehler = 1; } + + // Generate random ON and OFF times (in milliseconds) + // Range is 100–125 ms, which produces only slight visual variation. + int onTime = random(100, 125); + int offTime = random(100, 125); + + // Turn the selected LED ON + digitalWrite(leds[led], HIGH); + // Wait for the randomly generated ON duration + delay(onTime); + + // Turn the same LED OFF + digitalWrite(leds[led], LOW); + // Wait for the randomly generated OFF duration + delay(offTime); +} From 2c25ecc87b22a8e7bb8c1e0359ae601c8ee657f6 Mon Sep 17 00:00:00 2001 From: der-programmer1 Date: Thu, 23 Oct 2025 22:45:13 +0200 Subject: [PATCH 03/18] Updated file name to README.rm --- README.md => README.rm | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README.md => README.rm (100%) diff --git a/README.md b/README.rm similarity index 100% rename from README.md rename to README.rm From af623c895ac55592de583ee24dd05937398027f4 Mon Sep 17 00:00:00 2001 From: der-programmer1 Date: Fri, 24 Oct 2025 10:45:05 +0200 Subject: [PATCH 04/18] Delete First_Led_Code.txt --- First_Led_Code.txt | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 First_Led_Code.txt diff --git a/First_Led_Code.txt b/First_Led_Code.txt deleted file mode 100644 index 9c0d706..0000000 --- a/First_Led_Code.txt +++ /dev/null @@ -1,36 +0,0 @@ - // You tell the Arduino, that there is something on the following Pins: - -const int LedOnePin = 3; // Led on Pin 3 -const int LedTwoPin = 6; // Led on Pin 6 -const int LedThreePin = 9; // Led on Pin 9 - -void setup() { - // Now you tell the Arduino, that he should give our LED's (Pin 3, 6, 9) Power. - - pinMode(LedOnePin, OUTPUT); - pinMode(LedTwoPin, OUTPUT); - pinMode(LedThreePin, OUTPUT); -} - -void loop() { - -int onTime = 500 // the onTime for the Led now is 0,5 seconds long -int offTime = 500 // the offTime for the Led now is 0,5 seconds long - -digitalWrite(LedOnePin, HIGH); // Led one has now HIGH Power (5V) -delay(500); // It is on for 0,5 seconds -digitalWrite(LedOnePin, LOW); // Power is LOW (0V) -delay(500); // offTime = 0,5 seconds - - -digitalWrite(LedTwoPin, HIGH); // Led two has now HIGH Power (5V) -delay(500); // It is on for 0,5 seconds -digitalWrite(LedTwoPin, LOW); // Power is LOW (0V) -delay(500); // offTime = 0,5 seconds - -digitalWrite(LedThreePin, HIGH); // Led three has now HIGH Power (5V) -delay(500); // It is on for 0,5 seconds -digitalWrite(LedThreePin, LOW); // Power is LOW (0V) -delay(500); // offTime = 0,5 seconds - -} From 164d273f4640138e69406b354c98d634aafcc384 Mon Sep 17 00:00:00 2001 From: der-programmer1 Date: Fri, 24 Oct 2025 10:45:15 +0200 Subject: [PATCH 05/18] Delete For the advanced --- For the advanced | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 For the advanced diff --git a/For the advanced b/For the advanced deleted file mode 100644 index 3005075..0000000 --- a/For the advanced +++ /dev/null @@ -1,45 +0,0 @@ -// Array containing the digital pins where the LEDs are connected -const int leds[] = {3, 6, 9}; - -// Variable to store which LED was last turned on (-1 = none yet) -int letzteLED = -1; - -// Counter to track how many times the same LED has been selected consecutively -int zaehler = 0; - -void setup() { - // Initialize the random number generator using analog noise from pin A0 - randomSeed(analogRead(A0)); - - // Set each LED pin as an OUTPUT - for (int i = 0; i < 3; i++) pinMode(leds[i], OUTPUT); -} - -void loop() { - // Determine which LED to activate next: - // - If the same LED has been selected 3 or more times in a row, - // a more complex random logic is used to reduce repetition. - // - Otherwise, a simple random selection from 0 to 2 is made. - // NOTE: This logic is compact but somewhat hard to read and could lead to uneven probability distribution. - int led = (zaehler >= 3) ? (random(0, 3 - (letzteLED == 2)) + (letzteLED == 0)) : random(0, 3); - - // Check if the same LED was selected again: - // - If yes, increment the repetition counter. - // - If not, reset the counter and update the "last LED" tracker. - if (led == letzteLED) zaehler++; else { letzteLED = led; zaehler = 1; } - - // Generate random ON and OFF times (in milliseconds) - // Range is 100–125 ms, which produces only slight visual variation. - int onTime = random(100, 125); - int offTime = random(100, 125); - - // Turn the selected LED ON - digitalWrite(leds[led], HIGH); - // Wait for the randomly generated ON duration - delay(onTime); - - // Turn the same LED OFF - digitalWrite(leds[led], LOW); - // Wait for the randomly generated OFF duration - delay(offTime); -} From 7a59d7f0eedf9be5de13d8c24f70d5ed7e07a61b Mon Sep 17 00:00:00 2001 From: der-programmer1 Date: Fri, 24 Oct 2025 10:54:01 +0200 Subject: [PATCH 06/18] Added new learning materials for Arduino basics Added new example code and beginner learning materials for Arduino LED programming. The goal is to make it easier for newcomers to understand and experiment. Enjoy learning and keep coding! --- .DS_Store | Bin 0 -> 6148 bytes .gitattributes | 37 +++++++++++++++++++++++-- Basics/Blink/Blink.ino | 21 ++++++++++++++ Basics/Blink/README.md | 14 ++++++++++ Basics/Fade/Fade.ino | 29 +++++++++++++++++++ Basics/Fade/README.md | 15 ++++++++++ Basics/Multiple_LEDs/Multiple_LEDs.ino | 28 +++++++++++++++++++ Basics/Multiple_LEDs/README.md | 14 ++++++++++ 8 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 .DS_Store create mode 100644 Basics/Blink/Blink.ino create mode 100644 Basics/Blink/README.md create mode 100644 Basics/Fade/Fade.ino create mode 100644 Basics/Fade/README.md create mode 100644 Basics/Multiple_LEDs/Multiple_LEDs.ino create mode 100644 Basics/Multiple_LEDs/README.md diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ebe408f4c6f2892134f298bcf35281fb93df3575 GIT binary patch literal 6148 zcmeHKyH3O~5S)b*ibQiIrGJ4x2+{Ec`~YwP2?=pU#MP$+eP;AfO9)sVZk~Cf0V!~(z-cbmUjMJ@KlJ~HB(0=?6!=#P*lKgL8Th2Ct&7Kbt!?yMy63#p r-8c^lhbYIyD92oQIlhRb%xga9eqT5z2A%Ps6ZJFTy2zx!Un}qdJ3JcO literal 0 HcmV?d00001 diff --git a/.gitattributes b/.gitattributes index dfe0770..28dd334 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,35 @@ -# Auto detect text files and perform LF normalization -* text=auto +# ----------------------------------------------------------- +# Git Attributes for Arduino Projects +# Ensures consistent line endings, clean diffs, and proper +# language detection on GitHub. +# ----------------------------------------------------------- + +# Automatically normalize line endings (cross-platform safe) +* text=auto eol=lf + +# Treat Arduino sketch files as text for proper diffs +*.ino text diff + +# Explicitly mark common text-based files +*.cpp text diff +*.h text diff +*.c text diff +*.md text diff +*.txt text diff + +# Treat image and binary files properly (no diffs) +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.bmp binary +*.zip binary +*.exe binary + +# Optional: tell GitHub Linguist which files are documentation +*.md linguist-documentation=true + +# Optional: ignore build artifacts and OS files from stats +*.hex linguist-generated=true +*.bin linguist-generated=true +.DS_Store linguist-vendored=true diff --git a/Basics/Blink/Blink.ino b/Basics/Blink/Blink.ino new file mode 100644 index 0000000..c9d8821 --- /dev/null +++ b/Basics/Blink/Blink.ino @@ -0,0 +1,21 @@ +/* + Blink + ----- + The simplest example to start with Arduino. + This program turns an LED on for one second, then off for one second, repeatedly. + + Hardware setup: + - Connect an LED to digital pin 13 through a 220Ω resistor or without. Does not matter. +*/ + +void setup() { + // Initialize digital pin 13 as an output. + pinMode(13, OUTPUT); +} + +void loop() { + digitalWrite(13, HIGH); // Turn the LED on + delay(1000); // Wait for one second + digitalWrite(13, LOW); // Turn the LED off + delay(1000); // Wait for one second +} \ No newline at end of file diff --git a/Basics/Blink/README.md b/Basics/Blink/README.md new file mode 100644 index 0000000..8b13d53 --- /dev/null +++ b/Basics/Blink/README.md @@ -0,0 +1,14 @@ +# Blink Example + +The most basic Arduino example — making an LED blink on and off. + +## What You Learn +- How to set up an output pin +- The use of `digitalWrite()` and `delay()` +- The structure of `setup()` and `loop()` functions + +## Circuit +- LED connected to pin 13 (through a 220Ω resistor) +- Ground connected to the LED’s cathode + +This example introduces the fundamental concept of digital output control in Arduino. \ No newline at end of file diff --git a/Basics/Fade/Fade.ino b/Basics/Fade/Fade.ino new file mode 100644 index 0000000..431c755 --- /dev/null +++ b/Basics/Fade/Fade.ino @@ -0,0 +1,29 @@ +/* + Fade + ---- + Demonstrates the use of PWM (Pulse Width Modulation) to control LED brightness. + The LED will gradually fade in and out. + + Hardware setup: + - LED connected to pin 9 through a 220Ω resistor. +*/ + +int led = 9; // PWM-capable pin +int brightness = 0; // Current brightness level +int fadeAmount = 5; // Amount to change brightness each step + +void setup() { + pinMode(led, OUTPUT); +} + +void loop() { + analogWrite(led, brightness); // Set LED brightness + brightness = brightness + fadeAmount; + + // Reverse direction at limits + if (brightness <= 0 || brightness >= 255) { + fadeAmount = -fadeAmount; + } + + delay(30); // Adjust speed of fade +} diff --git a/Basics/Fade/README.md b/Basics/Fade/README.md new file mode 100644 index 0000000..29f57a4 --- /dev/null +++ b/Basics/Fade/README.md @@ -0,0 +1,15 @@ +# Fade Example + +This example introduces analog control through PWM (Pulse Width Modulation) to vary LED brightness smoothly. + +## What You Learn +- How to use `analogWrite()` for PWM control +- How to create smooth transitions with variables +- The concept of analog output in Arduino + +## Circuit +- LED connected to pin 9 (PWM-capable) +- 220Ω resistor between pin and LED + +This project helps you understand how to simulate analog control digitally — essential for dimming lights or +controlling motors. diff --git a/Basics/Multiple_LEDs/Multiple_LEDs.ino b/Basics/Multiple_LEDs/Multiple_LEDs.ino new file mode 100644 index 0000000..c7f594d --- /dev/null +++ b/Basics/Multiple_LEDs/Multiple_LEDs.ino @@ -0,0 +1,28 @@ +/* + Multiple LEDs + ------------- + This example shows how to control multiple LEDs one after another. + Each LED turns on and off in sequence. + + Hardware setup: + - 3 LEDs connected to pins 8, 9, and 10 (through 220Ω resistors). +*/ + +int ledPins[] = {8, 9, 10}; // LED pins +int numLeds = 3; // Number of LEDs + +void setup() { + // Set all LED pins as outputs + for (int i = 0; i < numLeds; i++) { + pinMode(ledPins[i], OUTPUT); + } +} + +void loop() { + // Turn each LED on and off in sequence + for (int i = 0; i < numLeds; i++) { + digitalWrite(ledPins[i], HIGH); // LED on + delay(500); // LED is on for half a second + digitalWrite(ledPins[i], LOW); // LED off + } +} \ No newline at end of file diff --git a/Basics/Multiple_LEDs/README.md b/Basics/Multiple_LEDs/README.md new file mode 100644 index 0000000..1defda4 --- /dev/null +++ b/Basics/Multiple_LEDs/README.md @@ -0,0 +1,14 @@ +# Multiple LEDs Example + +This example demonstrates how to control several LEDs in sequence using loops. + +## What You Learn +- How to use arrays to manage multiple output pins +- How to iterate with `for` loops +- Sequential LED control + +## Circuit +- Three LEDs connected to pins 8, 9, and 10 +- Each LED connected through a 220Ω resistor to ground + +This example builds on the basics by introducing arrays and loop structures. \ No newline at end of file From 168875b037eb75494e04c7435653d7070e1ed6ae Mon Sep 17 00:00:00 2001 From: der-programmer1 Date: Fri, 24 Oct 2025 14:46:12 +0200 Subject: [PATCH 07/18] Update Basics README with improved structure and clearer learning objectives Refined Basics README for clarity, learning goals, and structure --- Advanced/Button_Control/Button_Control.ino | 30 +++++++++++++++ Advanced/Button_Control/README.md | 14 +++++++ Advanced/Patterns/Patterns.ino | 44 ++++++++++++++++++++++ Advanced/Patterns/README.md | 14 +++++++ Advanced/README.md | 10 +++++ Advanced/Random_Effects/README.md | 14 +++++++ Advanced/Random_Effects/Random_Effects.ino | 28 ++++++++++++++ Basics/README.md | 32 ++++++++++++++++ 8 files changed, 186 insertions(+) create mode 100644 Advanced/Button_Control/Button_Control.ino create mode 100644 Advanced/Button_Control/README.md create mode 100644 Advanced/Patterns/Patterns.ino create mode 100644 Advanced/Patterns/README.md create mode 100644 Advanced/README.md create mode 100644 Advanced/Random_Effects/README.md create mode 100644 Advanced/Random_Effects/Random_Effects.ino create mode 100644 Basics/README.md diff --git a/Advanced/Button_Control/Button_Control.ino b/Advanced/Button_Control/Button_Control.ino new file mode 100644 index 0000000..0b45c49 --- /dev/null +++ b/Advanced/Button_Control/Button_Control.ino @@ -0,0 +1,30 @@ +/* + Button Control + -------------- + Demonstrates how to control an LED using a push button. + When the button is pressed, the LED turns on; otherwise, it turns off. + + Hardware setup: + - LED connected to pin 9 through a 220Ω resistor. Also works without + - Push button connected between pin 2 and ground + - Uses the internal pull-up resistor for stable input +*/ + +const int buttonPin = 2; +const int ledPin = 9; +int buttonState = 0; + +void setup() { + pinMode(ledPin, OUTPUT); + pinMode(buttonPin, INPUT_PULLUP); // internal pull-up, so LOW = pressed +} + +void loop() { + buttonState = digitalRead(buttonPin); + + if (buttonState == LOW) { + digitalWrite(ledPin, HIGH); // Button pressed + } else { + digitalWrite(ledPin, LOW); // Button released + } +} diff --git a/Advanced/Button_Control/README.md b/Advanced/Button_Control/README.md new file mode 100644 index 0000000..9dd4ff0 --- /dev/null +++ b/Advanced/Button_Control/README.md @@ -0,0 +1,14 @@ +# Button Control Example + +This example demonstrates how to use a push button to control an LED. + +## What You Learn +- Reading digital input from a button +- Using `INPUT_PULLUP` for reliable button detection +- Applying conditional logic with `if` statements + +## Circuit +- LED connected to pin 9 (with a 220Ω resistor(actually does not matter)) +- Button connected to pin 2 and ground + +When the button is pressed, the LED turns on. This is your first step into interactive Arduino projects. diff --git a/Advanced/Patterns/Patterns.ino b/Advanced/Patterns/Patterns.ino new file mode 100644 index 0000000..cd1c2d5 --- /dev/null +++ b/Advanced/Patterns/Patterns.ino @@ -0,0 +1,44 @@ +/* + Patterns + -------- + Demonstrates how to create repeating LED patterns. + Uses loops and arrays to build structured light effects. + + Hardware setup: + - 4 LEDs connected to pins 8, 9, 10, and 11 (each with 220Ω resistors(does not matter)) +*/ + +int leds[] = {8, 9, 10, 11}; +int numLeds = 4; + +void setup() { + for (int i = 0; i < numLeds; i++) { + pinMode(leds[i], OUTPUT); + } +} + +void loop() { + // Pattern 1: Forward chase + for (int i = 0; i < numLeds; i++) { + digitalWrite(leds[i], HIGH); + delay(150); + digitalWrite(leds[i], LOW); + } + + // Pattern 2: Reverse chase + for (int i = numLeds - 1; i >= 0; i--) { + digitalWrite(leds[i], HIGH); + delay(150); + digitalWrite(leds[i], LOW); + } + + // Pattern 3: Blink all LEDs + for (int i = 0; i < numLeds; i++) { + digitalWrite(leds[i], HIGH); + } + delay(300); + for (int i = 0; i < numLeds; i++) { + digitalWrite(leds[i], LOW); + } + delay(300); +} diff --git a/Advanced/Patterns/README.md b/Advanced/Patterns/README.md new file mode 100644 index 0000000..b57b60f --- /dev/null +++ b/Advanced/Patterns/README.md @@ -0,0 +1,14 @@ +# LED Patterns Example + +This example shows how to create LED patterns using loops and arrays. + +## What You Learn +- Using arrays to control multiple pins +- Creating sequential and reverse lighting patterns +- Managing timing with the `delay()` function + +## Circuit +- Four LEDs connected to pins 8–11 (each with a 220Ω resistor(does'nt matter)) +- Common ground connection + +These patterns help you practice structured programming and timing logic. diff --git a/Advanced/README.md b/Advanced/README.md new file mode 100644 index 0000000..55af650 --- /dev/null +++ b/Advanced/README.md @@ -0,0 +1,10 @@ +# Advanced Arduino LED Examples + +This section contains more complex Arduino LED projects that build upon the basic concepts. + +## Included Examples +- **Button Control:** Adds interactivity through digital input. +- **Patterns:** Creates structured LED sequences. +- **Random Effects:** Introduces randomness and dynamic lighting. + +These projects are designed to deepen your understanding of logic, timing, and user interaction. diff --git a/Advanced/Random_Effects/README.md b/Advanced/Random_Effects/README.md new file mode 100644 index 0000000..5e10474 --- /dev/null +++ b/Advanced/Random_Effects/README.md @@ -0,0 +1,14 @@ +# Random LED Effects Example + +This example uses the `random()` function to create unpredictable LED lighting. + +## What You Learn +- Generating random numbers with `random()` and `randomSeed()` +- Creating dynamic, non-repetitive LED effects +- Combining randomness with control logic + +## Circuit +- Three LEDs connected to pins 8–10 (each with a 220Ω resistor(really does'nt matter(for short life LED))) +- Common ground connection + +Adding randomness makes LED projects look more organic and fun. diff --git a/Advanced/Random_Effects/Random_Effects.ino b/Advanced/Random_Effects/Random_Effects.ino new file mode 100644 index 0000000..eefd784 --- /dev/null +++ b/Advanced/Random_Effects/Random_Effects.ino @@ -0,0 +1,28 @@ +/* + Random Effects + --------------- + Demonstrates how to use the random() function to create unpredictable LED behavior. + + Hardware setup: + - 3 LEDs connected to pins 8, 9, and 10 through 220Ω resistors(resrstors does'nt matter) +*/ + +int leds[] = {8, 9, 10}; +int numLeds = 3; + +void setup() { + for (int i = 0; i < numLeds; i++) { + pinMode(leds[i], OUTPUT); + } + + randomSeed(analogRead(0)); // initialize random generator +} + +void loop() { + int ledIndex = random(0, numLeds); // pick a random LED + int delayTime = random(100, 700); // random delay + + digitalWrite(leds[ledIndex], HIGH); + delay(delayTime); + digitalWrite(leds[ledIndex], LOW); +} diff --git a/Basics/README.md b/Basics/README.md new file mode 100644 index 0000000..a033d2f --- /dev/null +++ b/Basics/README.md @@ -0,0 +1,32 @@ +# Arduino LED Basics + +This section introduces the fundamental concepts of Arduino LED programming. +You’ll learn how to control LEDs, understand digital outputs, and build confidence with simple circuits. + +## Included Examples +- **Blink:** The classic first Arduino program — turn an LED on and off at regular intervals. +- **Multiple LEDs:** Control several LEDs independently using loops and pin arrays. +- **Fade:** Create smooth LED brightness transitions using PWM (Pulse Width Modulation). + +## What You Learn +- How to use `pinMode()` and `digitalWrite()` to control pins +- How to work with time delays using `delay()` +- Introduction to `analogWrite()` for dimming LEDs +- Basic use of loops (`for`) for repetitive tasks + +## Circuit Requirements +- 1–3 LEDs (any color) +- 220Ω resistors(Does not matter..) +- Jumper wires +- Breadboard +- Arduino board (e.g., Uno, Nano, or Mega) + +## Learning Goal +By completing the Basics section, you will: +- Understand how Arduino handles digital output +- Gain confidence with simple electronic components +- Be ready to move on to **interactive and advanced LED projects** + +--- + +> 💡 Tip: Experiment by changing delay times, brightness levels, or pin numbers to explore how each adjustment affects behavior. From 5f7f3e09a19ae319efadcccbf70800498cbd8c02 Mon Sep 17 00:00:00 2001 From: der-programmer1 Date: Fri, 24 Oct 2025 16:16:57 +0200 Subject: [PATCH 08/18] Created Blink_with_random_Delay Added File named `Blink_with_random_Delay.ino`. --- Basics/Blink/Blink_with_random_Delay.ino | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Basics/Blink/Blink_with_random_Delay.ino diff --git a/Basics/Blink/Blink_with_random_Delay.ino b/Basics/Blink/Blink_with_random_Delay.ino new file mode 100644 index 0000000..d64f143 --- /dev/null +++ b/Basics/Blink/Blink_with_random_Delay.ino @@ -0,0 +1,23 @@ +// led is on Pin 3 +const int led = 3; + +void setup() { + // led Pin(3) has Power OUTPUT + pinMode(led, OUTPUT); +} + +void loop() { + // brightness is random + int brightness = random(55, 255); + // onTime is between 0,1 and 0,3 seconds + int onTime = random(100, 300); + // offTime is between 0,1 and 0,19 seconds + int offTime = random(100, 190); + + analogWrite(led, brightness); + // as delay, we take our defined onTime + delay(onTime); + analogWrite(LOW); + // as delay, we take our defined offTime + delay(offTime); +} From f362885d6e68a18a65a9af04196f2e20bb4eecae Mon Sep 17 00:00:00 2001 From: der-programmer1 Date: Fri, 24 Oct 2025 16:19:20 +0200 Subject: [PATCH 09/18] Update Blink_with_random_Delay.ino --- Basics/Blink/Blink_with_random_Delay.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Basics/Blink/Blink_with_random_Delay.ino b/Basics/Blink/Blink_with_random_Delay.ino index d64f143..1f4f96f 100644 --- a/Basics/Blink/Blink_with_random_Delay.ino +++ b/Basics/Blink/Blink_with_random_Delay.ino @@ -14,10 +14,10 @@ void loop() { // offTime is between 0,1 and 0,19 seconds int offTime = random(100, 190); - analogWrite(led, brightness); + digitalWrite(led, brightness); // as delay, we take our defined onTime delay(onTime); - analogWrite(LOW); + digitalWrite(LOW); // as delay, we take our defined offTime delay(offTime); } From d33cf4cf176286a2d957fac05efa0b819a5c4a59 Mon Sep 17 00:00:00 2001 From: der-programmer1 Date: Fri, 24 Oct 2025 16:37:45 +0200 Subject: [PATCH 10/18] Add random timing LED control example Introduces Multiple_LEDs_random_time.ino to demonstrate controlling multiple LEDs with random on/off times. Updates README with additional details about delay usage and clarifies circuit notes. --- .../Multiple_LEDs_random_time.ino | 20 +++++++++++++++++++ Basics/Multiple_LEDs/README.md | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 Basics/Multiple_LEDs/Multiple_LEDs_random_time.ino diff --git a/Basics/Multiple_LEDs/Multiple_LEDs_random_time.ino b/Basics/Multiple_LEDs/Multiple_LEDs_random_time.ino new file mode 100644 index 0000000..dc0228f --- /dev/null +++ b/Basics/Multiple_LEDs/Multiple_LEDs_random_time.ino @@ -0,0 +1,20 @@ +const int ledPins[] = {3, 6, 9}; +int numLeds = 3; + +void setup() { + for (int i = 0; i < numLeds; i++) { + pinMode(ledPins[i], OUTPUT); + } +} + +void loop() { + int onTime = random(50, 200); + int offTime = random(40, 180); + + for (int i = 0; i < numLeds; i++) { + digitalWrite(ledPins[i], HIGH); + delay(onTime); + digitalWrite(ledPins[i], LOW); + delay(offTime); + } +} diff --git a/Basics/Multiple_LEDs/README.md b/Basics/Multiple_LEDs/README.md index 1defda4..63439f2 100644 --- a/Basics/Multiple_LEDs/README.md +++ b/Basics/Multiple_LEDs/README.md @@ -5,10 +5,11 @@ This example demonstrates how to control several LEDs in sequence using loops. ## What You Learn - How to use arrays to manage multiple output pins - How to iterate with `for` loops +The use od `delay` for `onTime` and `offTime` - Sequential LED control ## Circuit - Three LEDs connected to pins 8, 9, and 10 -- Each LED connected through a 220Ω resistor to ground +- Each LED connected through a 220Ω resistor to ground. Actually does not matter. This example builds on the basics by introducing arrays and loop structures. \ No newline at end of file From cf94e8331d02ac466a9ebaf2a7015ebe3d9b4323 Mon Sep 17 00:00:00 2001 From: der-programmer1 Date: Fri, 24 Oct 2025 16:54:06 +0200 Subject: [PATCH 11/18] Add Knight Rider and PWM Fading LED examples Introduced two new advanced Arduino LED projects: Knight Rider (sequenced running light effect) and PWM Fading (smooth LED brightness control). Updated Advanced/README.md to document all advanced projects and added corresponding README files for the new examples. --- Advanced/Knight_Rider/Knight_Rider.ino | 24 ++++++++++++ Advanced/Knight_Rider/README.md | 16 ++++++++ Advanced/PWM_Fading/PWM_Fading.ino | 19 +++++++++ Advanced/PWM_Fading/README.md | 16 ++++++++ Advanced/README.md | 54 ++++++++++++++++++++++---- 5 files changed, 122 insertions(+), 7 deletions(-) create mode 100644 Advanced/Knight_Rider/Knight_Rider.ino create mode 100644 Advanced/Knight_Rider/README.md create mode 100644 Advanced/PWM_Fading/PWM_Fading.ino create mode 100644 Advanced/PWM_Fading/README.md diff --git a/Advanced/Knight_Rider/Knight_Rider.ino b/Advanced/Knight_Rider/Knight_Rider.ino new file mode 100644 index 0000000..012adbb --- /dev/null +++ b/Advanced/Knight_Rider/Knight_Rider.ino @@ -0,0 +1,24 @@ +const int ledPins[] = {3, 5, 6, 9, 10}; // LED pins +int numLeds = 5; + +void setup() { + for(int i = 0; i < numLeds; i++) { + pinMode(ledPins[i], OUTPUT); // set all LED pins as output + } +} + +void loop() { + // forward sequence + for(int i = 0; i < numLeds; i++) { + digitalWrite(ledPins[i], HIGH); // turn LED on + delay(100); // wait + digitalWrite(ledPins[i], LOW); // turn LED off + } + + // backward sequence + for(int i = numLeds - 2; i > 0; i--) { + digitalWrite(ledPins[i], HIGH); + delay(100); + digitalWrite(ledPins[i], LOW); + } +} diff --git a/Advanced/Knight_Rider/README.md b/Advanced/Knight_Rider/README.md new file mode 100644 index 0000000..3cf40e8 --- /dev/null +++ b/Advanced/Knight_Rider/README.md @@ -0,0 +1,16 @@ +# Knight Rider LED Example + +This project creates a "Knight Rider" running light effect with multiple LEDs. + +## What You Learn +- Sequencing multiple LEDs +- Forward and backward animation +- Timing and delays + +## Hardware +- 5 LEDs connected to pins 3, 5, 6, 9, 10 +- 220Ω resistors(you know, it does not matter..) + +## How It Works +The LEDs turn on one after another in a forward sequence, then in a reverse sequence, simulating the famous +Knight Rider effect. \ No newline at end of file diff --git a/Advanced/PWM_Fading/PWM_Fading.ino b/Advanced/PWM_Fading/PWM_Fading.ino new file mode 100644 index 0000000..758f8bb --- /dev/null +++ b/Advanced/PWM_Fading/PWM_Fading.ino @@ -0,0 +1,19 @@ +const int ledPin = 9; // PWM-capable pin +int brightness = 0; // current brightness level +int fadeAmount = 5; // amount to change the brightness + +void setup() { + pinMode(ledPin, OUTPUT); // set the LED pin as output +} + +void loop() { + analogWrite(ledPin, brightness); // set the LED brightness + brightness += fadeAmount; // increase or decrease brightness + + // reverse direction at the ends + if(brightness <= 0 || brightness >= 255) { + fadeAmount = -fadeAmount; + } + + delay(30); // wait for 30 milliseconds +} diff --git a/Advanced/PWM_Fading/README.md b/Advanced/PWM_Fading/README.md new file mode 100644 index 0000000..b64b928 --- /dev/null +++ b/Advanced/PWM_Fading/README.md @@ -0,0 +1,16 @@ +# PWM Fading Example + +This example demonstrates how to fade an LED smoothly using PWM (Pulse Width Modulation). + +## What You Learn +- Using `analogWrite()` to control LED brightness +- Creating smooth increasing and decreasing loops +- Handling boundary conditions for variables + +## Hardware +- 1 LED connected to PWM pin 9 +- 220Ω resistor(actually does'nt matter..) + +## How It Works +The LED brightness increases and decreases gradually. The program reverses the fade direction when reaching the +minimum or maximum brightness, creating a continuous fading effect. diff --git a/Advanced/README.md b/Advanced/README.md index 55af650..3c3de38 100644 --- a/Advanced/README.md +++ b/Advanced/README.md @@ -1,10 +1,50 @@ -# Advanced Arduino LED Examples +# Advanced Arduino LED Projects -This section contains more complex Arduino LED projects that build upon the basic concepts. +This folder contains advanced Arduino LED projects designed for learners who have completed the basics and want to explore more complex concepts, including PWM, sequencing, and animation. -## Included Examples -- **Button Control:** Adds interactivity through digital input. -- **Patterns:** Creates structured LED sequences. -- **Random Effects:** Introduces randomness and dynamic lighting. +## Included Projects -These projects are designed to deepen your understanding of logic, timing, and user interaction. +### 1. Button Control +- **Folder:** Button_Control/ +- **Purpose:** Learn how to control LEDs interactively using a push button. +- **What You Learn:** Digital input reading, conditional logic, using `INPUT_PULLUP`, simple interactivity. +- **Hardware:** LEDs, push button, 220Ω resistors. + +### 2. Patterns +- **Folder:** Patterns/ +- **Purpose:** Create structured LED sequences to understand loops and arrays. +- **What You Learn:** Controlling multiple LEDs with arrays, sequencing, timing with `delay()`. +- **Hardware:** 4 LEDs, 220Ω resistors. + +### 3. Random Effects +- **Folder:** Random_Effects/ +- **Purpose:** Add unpredictability and creative effects to LEDs. +- **What You Learn:** Using `random()` and `randomSeed()`, dynamic lighting effects. +- **Hardware:** 3 LEDs, 220Ω resistors. + +### 4. PWM Fading +- **Folder:** PWM_Fading/ +- **Purpose:** Smoothly fade an LED in and out using PWM. +- **What You Learn:** Using `analogWrite()` for brightness control, loops with variable increments, handling boundaries. +- **Hardware:** 1 LED on PWM pin, 220Ω resistor. + +### 5. Knight Rider +- **Folder:** Knight_Rider/ +- **Purpose:** Simulate the famous "Knight Rider" running light effect. +- **What You Learn:** Sequencing multiple LEDs, forward and backward animation, timing. +- **Hardware:** 5 LEDs, 220Ω resistors. + +## Learning Goals +After completing these projects, learners will: +- Understand advanced LED control techniques. +- Gain experience with PWM for smooth fading. +- Learn how to create sequences and animations. +- Explore interactive control using buttons. +- Develop confidence in structuring multiple Arduino projects. + +## How to Use +Each project folder contains: +- **`.ino` file:** Complete Arduino sketch ready to upload. +- **README.md:** Detailed explanation of the project, what you learn, and hardware setup. + +Open a project folder, upload the `.ino` file to your Arduino board, and experiment with the code. Adjust timing, sequences, and hardware as needed to enhance learning and creativity. From c74c9f86a578b0222c8e2b039cd93d2f21c56401 Mon Sep 17 00:00:00 2001 From: der-programmer1 Date: Fri, 24 Oct 2025 17:34:10 +0200 Subject: [PATCH 12/18] Add code templates and update documentation Added Arduino code templates for basic (blink, button input) and advanced (PWM breathing) examples. Updated README files in Advanced and root directories to clarify project structure and learning goals, and introduced a README for code templates with usage instructions. --- Advanced/README.md | 53 ++++++++----------- .../Advanced/PWM_Breathing_Template.ino | 21 ++++++++ .../Basics/Blink_Template.ino | 17 ++++++ .../Basics/Button_Input.ino | 19 +++++++ Code_Templates_with_examples/README.md | 28 ++++++++++ README.rm | 37 ++++++++++++- 6 files changed, 143 insertions(+), 32 deletions(-) create mode 100644 Code_Templates_with_examples/Advanced/PWM_Breathing_Template.ino create mode 100644 Code_Templates_with_examples/Basics/Blink_Template.ino create mode 100644 Code_Templates_with_examples/Basics/Button_Input.ino create mode 100644 Code_Templates_with_examples/README.md diff --git a/Advanced/README.md b/Advanced/README.md index 3c3de38..35222d4 100644 --- a/Advanced/README.md +++ b/Advanced/README.md @@ -1,50 +1,43 @@ # Advanced Arduino LED Projects -This folder contains advanced Arduino LED projects designed for learners who have completed the basics and want to explore more complex concepts, including PWM, sequencing, and animation. +This folder contains advanced LED projects for learners who have completed the basics. -## Included Projects +## Projects Overview -### 1. Button Control +### Button Control - **Folder:** Button_Control/ -- **Purpose:** Learn how to control LEDs interactively using a push button. -- **What You Learn:** Digital input reading, conditional logic, using `INPUT_PULLUP`, simple interactivity. +- **Purpose:** Learn interactive LED control using a push button. +- **Learnings:** Digital input reading, conditional logic, debouncing. - **Hardware:** LEDs, push button, 220Ω resistors. -### 2. Patterns +### Patterns - **Folder:** Patterns/ -- **Purpose:** Create structured LED sequences to understand loops and arrays. -- **What You Learn:** Controlling multiple LEDs with arrays, sequencing, timing with `delay()`. +- **Purpose:** Structured LED sequences to understand loops and arrays. +- **Learnings:** Arrays, loops, timing with `delay()`. - **Hardware:** 4 LEDs, 220Ω resistors. -### 3. Random Effects +### Random Effects - **Folder:** Random_Effects/ -- **Purpose:** Add unpredictability and creative effects to LEDs. -- **What You Learn:** Using `random()` and `randomSeed()`, dynamic lighting effects. +- **Purpose:** Dynamic and unpredictable LED effects. +- **Learnings:** `random()` usage, `randomSeed()`, creating dynamic animations. - **Hardware:** 3 LEDs, 220Ω resistors. -### 4. PWM Fading +### PWM Fading - **Folder:** PWM_Fading/ -- **Purpose:** Smoothly fade an LED in and out using PWM. -- **What You Learn:** Using `analogWrite()` for brightness control, loops with variable increments, handling boundaries. +- **Purpose:** Smooth LED fading using PWM. +- **Learnings:** `analogWrite()`, loops, variable increments. - **Hardware:** 1 LED on PWM pin, 220Ω resistor. -### 5. Knight Rider +### Knight Rider - **Folder:** Knight_Rider/ -- **Purpose:** Simulate the famous "Knight Rider" running light effect. -- **What You Learn:** Sequencing multiple LEDs, forward and backward animation, timing. +- **Purpose:** Running light effect forward and backward. +- **Learnings:** Sequencing, forward/backward animation, timing control. - **Hardware:** 5 LEDs, 220Ω resistors. +--- + ## Learning Goals -After completing these projects, learners will: -- Understand advanced LED control techniques. -- Gain experience with PWM for smooth fading. -- Learn how to create sequences and animations. -- Explore interactive control using buttons. -- Develop confidence in structuring multiple Arduino projects. - -## How to Use -Each project folder contains: -- **`.ino` file:** Complete Arduino sketch ready to upload. -- **README.md:** Detailed explanation of the project, what you learn, and hardware setup. - -Open a project folder, upload the `.ino` file to your Arduino board, and experiment with the code. Adjust timing, sequences, and hardware as needed to enhance learning and creativity. +- Advanced LED control techniques. +- Sequencing, animation, and PWM usage. +- Interactive controls with buttons. +- Structuring multiple Arduino projects professionally. \ No newline at end of file diff --git a/Code_Templates_with_examples/Advanced/PWM_Breathing_Template.ino b/Code_Templates_with_examples/Advanced/PWM_Breathing_Template.ino new file mode 100644 index 0000000..e9bbb19 --- /dev/null +++ b/Code_Templates_with_examples/Advanced/PWM_Breathing_Template.ino @@ -0,0 +1,21 @@ +// PWM Breathing LED Template +// Smoothly increases and decreases LED brightness using PWM. + +const int ledPin = 9; +int brightness = 0; +int fadeAmount = 5; + +void setup() { + pinMode(ledPin, OUTPUT); +} + +void loop() { + analogWrite(ledPin, brightness); // Set LED brightness + brightness += fadeAmount; + + if(brightness <= 0 || brightness >= 255){ + fadeAmount = -fadeAmount; // Reverse direction + } + + delay(30); // Smooth transition +} diff --git a/Code_Templates_with_examples/Basics/Blink_Template.ino b/Code_Templates_with_examples/Basics/Blink_Template.ino new file mode 100644 index 0000000..f0990e3 --- /dev/null +++ b/Code_Templates_with_examples/Basics/Blink_Template.ino @@ -0,0 +1,17 @@ +// Blink Template +// Simple example of turning an LED on and off repeatedly. + +const int ledPin = 13; // Built-in LED +const int ON_TIME = 500; +const int OFF_TIME = 500; + +void setup() { + pinMode(ledPin, OUTPUT); // Set LED pin as output +} + +void loop() { + digitalWrite(ledPin, HIGH); // Turn LED on + delay(ON_TIME); + digitalWrite(ledPin, LOW); // Turn LED off + delay(OFF_TIME); +} diff --git a/Code_Templates_with_examples/Basics/Button_Input.ino b/Code_Templates_with_examples/Basics/Button_Input.ino new file mode 100644 index 0000000..4d094c4 --- /dev/null +++ b/Code_Templates_with_examples/Basics/Button_Input.ino @@ -0,0 +1,19 @@ +// Button Input Template +// Reads a button press and toggles an LED. + +const int ledPin = 13; +const int buttonPin = 2; +bool ledState = false; + +void setup() { + pinMode(ledPin, OUTPUT); + pinMode(buttonPin, INPUT_PULLUP); // Button with internal pull-up +} + +void loop() { + if(digitalRead(buttonPin) == LOW){ // Button pressed + ledState = !ledState; // Toggle LED state + digitalWrite(ledPin, ledState); + delay(200); // Debounce + } +} diff --git a/Code_Templates_with_examples/README.md b/Code_Templates_with_examples/README.md new file mode 100644 index 0000000..3021eef --- /dev/null +++ b/Code_Templates_with_examples/README.md @@ -0,0 +1,28 @@ +# Code Templates with Examples + +This folder contains general Arduino code templates for both beginners and advanced learners. +The templates are designed to provide a starting point for creating new projects and understanding common Arduino programming concepts. + +## Basics +1. **Blink_Template.ino** + - Blinks an LED repeatedly. + - Teaches digital output and timing with `delay()`. + +2. **Button_Input_Template.ino** + - Reads a button press and toggles an LED. + - Teaches digital input, state toggling, and simple debounce. + +## Advanced +1. **PWM_Breathing_Template.ino** + - Smoothly increases and decreases LED brightness using PWM. + - Teaches `analogWrite()` and creating smooth animations. + +2. **LED_Sequence_Template.ino** + - Turns multiple LEDs on in a sequence and then back. + - Teaches arrays, loops, and sequencing multiple outputs. + +## How to Use +- Open any template `.ino` file in the Arduino IDE. +- Connect the necessary components according to the code comments. +- Upload the sketch to your Arduino board and observe the behavior. +- Modify variables and loops to experiment and learn. diff --git a/README.rm b/README.rm index ecdab72..b64d4f3 100644 --- a/README.rm +++ b/README.rm @@ -1,2 +1,35 @@ -# Arduino_Led_Programming -Here, you can fing interesting Arduino Code for LED's +# Arduino LED Programming Repository + +This repository is a comprehensive learning resource for Arduino LED programming. +It includes both basic and advanced projects, as well as code templates with examples for fast experimentation. + +## Repository Structure + +- **Basics/** + Simple LED projects to learn the fundamentals, including blinking, multiple LEDs, and fading. + +- **Advanced/** + More complex projects covering interactive control, sequences, PWM fading, and animation effects like Knight Rider. + +- **code_templates_with_examples/** + Ready-to-use code templates for beginners and advanced users. Includes both basic examples (blink, button input) and advanced examples (PWM breathing, LED sequences). + + + + +- **Coming soon** + Circuit diagrams, screenshots, or GIFs to support learning. + +## Getting Started + +1. Install the Arduino IDE. +2. Connect your Arduino board. +3. Open the desired `.ino` file in the IDE. +4. Upload the sketch and follow any instructions in the project README. + +## Learning Goals + +- Understand LED control using digital and PWM signals. +- Learn sequencing, animation, and interactive projects. +- Apply structured coding practices with arrays, loops, and functions. +- Build confidence progressing from beginner to advanced projects. From d272d9a6ee6c0a2ba2deb3ee0090b0b7ba6b5541 Mon Sep 17 00:00:00 2001 From: der-programmer1 Date: Mon, 27 Oct 2025 12:36:13 +0100 Subject: [PATCH 13/18] Added Buzzer Codes to expand our Repository --- .../basic_Buzzer_Code.ino | 17 ++++++++++++++++ .../buzzer_with_random/Buzzer_with_random.ino | 20 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 buzzer_Codes/basic_Buzzer_LED_Code/basic_Buzzer_Code.ino create mode 100644 buzzer_Codes/buzzer_with_random/Buzzer_with_random.ino diff --git a/buzzer_Codes/basic_Buzzer_LED_Code/basic_Buzzer_Code.ino b/buzzer_Codes/basic_Buzzer_LED_Code/basic_Buzzer_Code.ino new file mode 100644 index 0000000..292028b --- /dev/null +++ b/buzzer_Codes/basic_Buzzer_LED_Code/basic_Buzzer_Code.ino @@ -0,0 +1,17 @@ +// define Buzzer on Pin 9 +const int Buzzer = 9; + +void setup() { + // set Buzzer Pin as an OUTPUT + pinMode(buzzer, OUTPUT); +} + +void loop() { + // buzzer Power is 0,3 KHz + tone(buzzer, 300); + // onTime for Buzzer are 0,3 seconds + delay(300); + offTone(buzzer); + // offTime for buzzer are 0,3 seconds + delay(300); +} diff --git a/buzzer_Codes/buzzer_with_random/Buzzer_with_random.ino b/buzzer_Codes/buzzer_with_random/Buzzer_with_random.ino new file mode 100644 index 0000000..e4c4267 --- /dev/null +++ b/buzzer_Codes/buzzer_with_random/Buzzer_with_random.ino @@ -0,0 +1,20 @@ +// Buzzer is defined on Pin 9 +const int buzzer = 9; +// onTime for buzzer us between 0,05 and 0,23 seconds long. same with offTime +int onTime = random(50, 230); +int offTIme = random(50, 230); +// OUTPUT Power for buzzer is between 0,05 and 0,35 KHz +int buzzerPower = random(50, 350); + +void setup() { + pinMode(buzzer, OUTPUT); +} + +void loop() { + // for the tone, we use our defined buzzerPower + tone(buzzer, buzzerPower); + // onTime also is what we defined... also offTime + delay(onTime); + offTone(buzzer); + delay(offTime); +} From 7d727b3390660a5e952492a1b9f62e4b3548c66e Mon Sep 17 00:00:00 2001 From: der-programmer1 Date: Mon, 27 Oct 2025 15:44:38 +0100 Subject: [PATCH 14/18] Added Templates for you, to train your skills and customise the codes. --- .../basic_Buzzer_LED_Code_the_Template | 14 ++++++++++++++ .../buzzer_with_random_the_template | 15 +++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 buzzer_Codes/basic_Buzzer_LED_Code/basic_Buzzer_LED_Code_the_Template create mode 100644 buzzer_Codes/buzzer_with_random/buzzer_with_random_the_template diff --git a/buzzer_Codes/basic_Buzzer_LED_Code/basic_Buzzer_LED_Code_the_Template b/buzzer_Codes/basic_Buzzer_LED_Code/basic_Buzzer_LED_Code_the_Template new file mode 100644 index 0000000..4394673 --- /dev/null +++ b/buzzer_Codes/basic_Buzzer_LED_Code/basic_Buzzer_LED_Code_the_Template @@ -0,0 +1,14 @@ +// define Buzzer on Pin(9, for example(... = 9;)) +const int Buzzer = ; + +void setup() { + // set Buzzer Pin as an OUTPUT(is already) + pinMode(buzzer, OUTPUT); +} + +void loop() { + tone(buzzer, ); // set power in KHz. 1000 = 1KHz(make between 0,1 and 1 KHz) + delay(); // set the onTime in seconds. 1000 = 1 second + offTone(buzzer); + delay(); // set the offTime in seconds +} diff --git a/buzzer_Codes/buzzer_with_random/buzzer_with_random_the_template b/buzzer_Codes/buzzer_with_random/buzzer_with_random_the_template new file mode 100644 index 0000000..7e64f07 --- /dev/null +++ b/buzzer_Codes/buzzer_with_random/buzzer_with_random_the_template @@ -0,0 +1,15 @@ +const int buzzer = ; // set Pin for buzzer. 9 for example +int onTime = random(, ); // set min. and max. time delay +int offTIme = random(, ); // set min. and max. time delay +int buzzerPower = random( , ); // set min. and max. power. 1000 is 1 KHz(set between 0,1 and 1) + +void setup() { + pinMode(buzzer, OUTPUT); +} + +void loop() { + tone(buzzer, buzzerPower); + delay(onTime); + offTone(buzzer); + delay(offTime); +} From ee45f201a293915e66eeb41308c9a59658ba04e3 Mon Sep 17 00:00:00 2001 From: der-programmer1 Date: Mon, 27 Oct 2025 17:25:23 +0100 Subject: [PATCH 15/18] error in the code has been corrected --- buzzer_Codes/basic_Buzzer_LED_Code/basic_Buzzer_Code.ino | 2 +- .../basic_Buzzer_LED_Code_the_Template | 6 +++--- buzzer_Codes/buzzer_with_random/Buzzer_with_random.ino | 4 ++-- .../buzzer_with_random/buzzer_with_random_the_template | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/buzzer_Codes/basic_Buzzer_LED_Code/basic_Buzzer_Code.ino b/buzzer_Codes/basic_Buzzer_LED_Code/basic_Buzzer_Code.ino index 292028b..f449d3f 100644 --- a/buzzer_Codes/basic_Buzzer_LED_Code/basic_Buzzer_Code.ino +++ b/buzzer_Codes/basic_Buzzer_LED_Code/basic_Buzzer_Code.ino @@ -11,7 +11,7 @@ void loop() { tone(buzzer, 300); // onTime for Buzzer are 0,3 seconds delay(300); - offTone(buzzer); + noTone(buzzer); // offTime for buzzer are 0,3 seconds delay(300); } diff --git a/buzzer_Codes/basic_Buzzer_LED_Code/basic_Buzzer_LED_Code_the_Template b/buzzer_Codes/basic_Buzzer_LED_Code/basic_Buzzer_LED_Code_the_Template index 4394673..e873acb 100644 --- a/buzzer_Codes/basic_Buzzer_LED_Code/basic_Buzzer_LED_Code_the_Template +++ b/buzzer_Codes/basic_Buzzer_LED_Code/basic_Buzzer_LED_Code_the_Template @@ -1,5 +1,5 @@ -// define Buzzer on Pin(9, for example(... = 9;)) -const int Buzzer = ; +// define Buzzer and led on Pin(9, for example(... = 9;)) +const int Buzzer, led = ; void setup() { // set Buzzer Pin as an OUTPUT(is already) @@ -9,6 +9,6 @@ void setup() { void loop() { tone(buzzer, ); // set power in KHz. 1000 = 1KHz(make between 0,1 and 1 KHz) delay(); // set the onTime in seconds. 1000 = 1 second - offTone(buzzer); + noTone(buzzer); delay(); // set the offTime in seconds } diff --git a/buzzer_Codes/buzzer_with_random/Buzzer_with_random.ino b/buzzer_Codes/buzzer_with_random/Buzzer_with_random.ino index e4c4267..664604f 100644 --- a/buzzer_Codes/buzzer_with_random/Buzzer_with_random.ino +++ b/buzzer_Codes/buzzer_with_random/Buzzer_with_random.ino @@ -1,7 +1,7 @@ // Buzzer is defined on Pin 9 const int buzzer = 9; // onTime for buzzer us between 0,05 and 0,23 seconds long. same with offTime -int onTime = random(50, 230); +int onTime = random(50, 400); int offTIme = random(50, 230); // OUTPUT Power for buzzer is between 0,05 and 0,35 KHz int buzzerPower = random(50, 350); @@ -15,6 +15,6 @@ void loop() { tone(buzzer, buzzerPower); // onTime also is what we defined... also offTime delay(onTime); - offTone(buzzer); + noTone(buzzer); delay(offTime); } diff --git a/buzzer_Codes/buzzer_with_random/buzzer_with_random_the_template b/buzzer_Codes/buzzer_with_random/buzzer_with_random_the_template index 7e64f07..d0f3e3f 100644 --- a/buzzer_Codes/buzzer_with_random/buzzer_with_random_the_template +++ b/buzzer_Codes/buzzer_with_random/buzzer_with_random_the_template @@ -10,6 +10,6 @@ void setup() { void loop() { tone(buzzer, buzzerPower); delay(onTime); - offTone(buzzer); + noTone(buzzer); delay(offTime); } From a4e0b35d1fb5c50fa5c2ba5e8660eb9d676729dd Mon Sep 17 00:00:00 2001 From: der-programmer1 Date: Mon, 27 Oct 2025 17:55:58 +0100 Subject: [PATCH 16/18] Add MIT License to the project --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..996c54c --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 der-programmer1. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From a0b6e2f6f881960a351cd9f136c6ec1dfee67b62 Mon Sep 17 00:00:00 2001 From: der-programmer1 Date: Mon, 27 Oct 2025 19:03:54 +0100 Subject: [PATCH 17/18] Update README.rm --- README.rm | 81 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 59 insertions(+), 22 deletions(-) diff --git a/README.rm b/README.rm index b64d4f3..07750f9 100644 --- a/README.rm +++ b/README.rm @@ -1,35 +1,72 @@ -# Arduino LED Programming Repository +# 🎛️ Arduino Projects Hub -This repository is a comprehensive learning resource for Arduino LED programming. -It includes both basic and advanced projects, as well as code templates with examples for fast experimentation. +Welcome to my **Arduino Projects Hub**, a growing collection of interactive hardware experiments. +This repository includes **LEDs, buzzers, sensors, and more**, with projects designed for **learning, prototyping, and creative experimentation**. -## Repository Structure +![Demo](docs/demo.gif) -- **Basics/** - Simple LED projects to learn the fundamentals, including blinking, multiple LEDs, and fading. +--- -- **Advanced/** - More complex projects covering interactive control, sequences, PWM fading, and animation effects like Knight Rider. +## 🌟 Current Features -- **code_templates_with_examples/** - Ready-to-use code templates for beginners and advanced users. Includes both basic examples (blink, button input) and advanced examples (PWM breathing, LED sequences). +- Randomized LED patterns and blinking experiments +- Buzzer tone generation with configurable randomness +- Basic input/output projects for Arduino beginners +- Configurable timing, patterns, and hardware assignments +- No external libraries required (most projects) +--- +## 🔮 Future Plans +- Expand with **more sensors** (temperature, light, motion) +- Add **interactive projects** (buttons, switches, user input) +- Create **multi-device synchronization** examples +- Include **advanced LED and buzzer patterns** +- Document and demo projects with GIFs, schematics, and tutorials -- **Coming soon** - Circuit diagrams, screenshots, or GIFs to support learning. +--- -## Getting Started +## 🛠️ Hardware Overview -1. Install the Arduino IDE. -2. Connect your Arduino board. -3. Open the desired `.ino` file in the IDE. -4. Upload the sketch and follow any instructions in the project README. +- Arduino Uno, Nano, or compatible boards +- LEDs, buzzers, resistors, and other basic components +- Jumper wires, breadboards, and optional sensors +- Flexible setup: the repository is not limited to a specific number of components -## Learning Goals +--- -- Understand LED control using digital and PWM signals. -- Learn sequencing, animation, and interactive projects. -- Apply structured coding practices with arrays, loops, and functions. -- Build confidence progressing from beginner to advanced projects. +## 📦 How to Use + +1. Browse the project folders in the repository +2. Open the `.ino` files in **Arduino IDE** +3. Connect the required hardware according to the folder/project description +4. Upload and run sketches +5. Experiment with timings, pins, and patterns to customize the behavior + +> Each project contains notes on **hardware setup, pin assignments, and configuration** to make it easy to start experimenting. + +--- + +## 🤝 Contributing + +Contributions, bug reports, or feature suggestions are **welcome**. + +- Fork the repository +- Add your project or improvements +- Submit a Pull Request +- Document your changes and any new hardware used + +--- + +## 📄 License + +All projects in this repository are under the **MIT License** – see [LICENSE](LICENSE) for details. + +--- + +## 📞 Contact + +Questions, suggestions, or feedback? Contact me at [your-email@example.com] + +Follow me on GitHub for updates: [https://github.com/der-programmer1](https://github.com/der-programmer1) \ No newline at end of file From 14cec2a4176c18c5965a9e0995292943f7b35d77 Mon Sep 17 00:00:00 2001 From: der-programmer1 Date: Mon, 27 Oct 2025 19:05:13 +0100 Subject: [PATCH 18/18] Rename README.rm to README.md --- README.rm => README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename README.rm => README.md (98%) diff --git a/README.rm b/README.md similarity index 98% rename from README.rm rename to README.md index 07750f9..68f24fa 100644 --- a/README.rm +++ b/README.md @@ -69,4 +69,4 @@ All projects in this repository are under the **MIT License** – see [LICENSE]( Questions, suggestions, or feedback? Contact me at [your-email@example.com] -Follow me on GitHub for updates: [https://github.com/der-programmer1](https://github.com/der-programmer1) \ No newline at end of file +Follow me on GitHub for updates: [https://github.com/der-programmer1](https://github.com/der-programmer1)