# LED Chaser

## Penjelasan Proyek

Pada proyek ini, kita akan membuat animasi LED bergerak dengan 8 buah LED.

## Daftar Komponen

Komponen yang diperlukan yaitu sebagai berikut:

* Board ESP32
* Breadboard
* LED 5 mm sebanyak 8 buah
* Resistor 330 Ω sebanyak 8 buah

## Rangkaian

Rangkaian yang dibuat yaitu sebagai berikut. LED dirangkai dengan konfigurasi rangkaian active-high pada pin-pin GPIO. Pin-pin GPIO yang digunakan dari kiri ke kanan yaitu 0, 4, 16, 17, 3, 1, 22, 23.

<figure><img src="/files/kwJ5AYpUtapz9dR6SJvP" alt="" width="441"><figcaption></figcaption></figure>

## Kode Program

Kode program yang dibuat yaitu sebagai berikut. Program akan menyalakan LED secara berurutan satu persatu dengan delay 20 ms. Setelah menyala semua, maka akan dipertahanlan selama 250 ms. setelah itu semua LED dimatikan dan dibiarkan mati selama 400 ms.

{% code title="led\_chaser.ino" lineNumbers="true" %}

```arduino
uint8_t pin[8] = {0, 4, 16, 17, 3, 1, 22, 23};

void setup()
{
  for (int i = 0; i <= 7; i++)
    pinMode(pin[i], OUTPUT);
}

void loop() 
{
  for (int i = 7; i >= 0; i--)
  {
    digitalWrite(pin[i], HIGH);
    delay(20);
  }
  delay(250);
  for (int i = 7; i >= 0; i--)
    digitalWrite(pin[i], LOW);
  delay(400);
}
```

{% endcode %}

{% embed url="<https://github.com/weenslab/proyek_arduino/tree/main/led/led_chaser>" %}

## Hasil

Hasil dari proyek ini yaitu pada gambar berikut ini.

<figure><img src="/files/XlO6LcyHBWsOu2pzSlw7" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://weenslab.gitbook.io/pages/proyek-arduino/kumpulan-proyek/led-chaser.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
