Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
37 changes: 35 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions Advanced/Button_Control/Button_Control.ino
Original file line number Diff line number Diff line change
@@ -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
}
}
14 changes: 14 additions & 0 deletions Advanced/Button_Control/README.md
Original file line number Diff line number Diff line change
@@ -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.
24 changes: 24 additions & 0 deletions Advanced/Knight_Rider/Knight_Rider.ino
Original file line number Diff line number Diff line change
@@ -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);
}
}
16 changes: 16 additions & 0 deletions Advanced/Knight_Rider/README.md
Original file line number Diff line number Diff line change
@@ -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.
19 changes: 19 additions & 0 deletions Advanced/PWM_Fading/PWM_Fading.ino
Original file line number Diff line number Diff line change
@@ -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
}
16 changes: 16 additions & 0 deletions Advanced/PWM_Fading/README.md
Original file line number Diff line number Diff line change
@@ -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.
44 changes: 44 additions & 0 deletions Advanced/Patterns/Patterns.ino
Original file line number Diff line number Diff line change
@@ -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);
}
14 changes: 14 additions & 0 deletions Advanced/Patterns/README.md
Original file line number Diff line number Diff line change
@@ -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.
43 changes: 43 additions & 0 deletions Advanced/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Advanced Arduino LED Projects

This folder contains advanced LED projects for learners who have completed the basics.

## Projects Overview

### Button Control
- **Folder:** Button_Control/
- **Purpose:** Learn interactive LED control using a push button.
- **Learnings:** Digital input reading, conditional logic, debouncing.
- **Hardware:** LEDs, push button, 220Ω resistors.

### Patterns
- **Folder:** Patterns/
- **Purpose:** Structured LED sequences to understand loops and arrays.
- **Learnings:** Arrays, loops, timing with `delay()`.
- **Hardware:** 4 LEDs, 220Ω resistors.

### Random Effects
- **Folder:** Random_Effects/
- **Purpose:** Dynamic and unpredictable LED effects.
- **Learnings:** `random()` usage, `randomSeed()`, creating dynamic animations.
- **Hardware:** 3 LEDs, 220Ω resistors.

### PWM Fading
- **Folder:** PWM_Fading/
- **Purpose:** Smooth LED fading using PWM.
- **Learnings:** `analogWrite()`, loops, variable increments.
- **Hardware:** 1 LED on PWM pin, 220Ω resistor.

### Knight Rider
- **Folder:** Knight_Rider/
- **Purpose:** Running light effect forward and backward.
- **Learnings:** Sequencing, forward/backward animation, timing control.
- **Hardware:** 5 LEDs, 220Ω resistors.

---

## Learning Goals
- Advanced LED control techniques.
- Sequencing, animation, and PWM usage.
- Interactive controls with buttons.
- Structuring multiple Arduino projects professionally.
14 changes: 14 additions & 0 deletions Advanced/Random_Effects/README.md
Original file line number Diff line number Diff line change
@@ -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.
28 changes: 28 additions & 0 deletions Advanced/Random_Effects/Random_Effects.ino
Original file line number Diff line number Diff line change
@@ -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);
}
21 changes: 21 additions & 0 deletions Basics/Blink/Blink.ino
Original file line number Diff line number Diff line change
@@ -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
}
23 changes: 23 additions & 0 deletions Basics/Blink/Blink_with_random_Delay.ino
Original file line number Diff line number Diff line change
@@ -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);

digitalWrite(led, brightness);
// as delay, we take our defined onTime
delay(onTime);
digitalWrite(LOW);
// as delay, we take our defined offTime
delay(offTime);
}
14 changes: 14 additions & 0 deletions Basics/Blink/README.md
Original file line number Diff line number Diff line change
@@ -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.
Loading