📈
Ween's Lab
UdemyYouTubeTikTok
  • Welcome
  • 📻FPGA Tutorials
    • FPGA Boards: Getting Started
      • Getting Started with PYNQ on Kria KV260 Vision AI Starter Kit
      • Getting Started with PYNQ on Red Pitaya STEMlab 125-14
      • Getting Started with PYNQ on ZYBO
    • FPGA Ethernet Tutorial
      • FPGA Tutorial Ethernet 1: Simple TCP Server
    • PYNQ FPGA Tutorial 101
      • Part 0: Introduction
      • Part 1: GPIO
      • Part 2: Custom IP
      • Part 3: Memory
      • Part 4: ANN Processor
    • PYNQ FPGA Tutorial 102
      • Part 0: Introduction
      • Part 1: Memory Mapped
      • Part 2: Direct Memory Access
      • Part 3: AXI-Lite Multiplier
      • Part 4: AXI-Stream Multiplier with DMA
      • Part 5: AXI-Lite GCD
      • Part 6: AXI-Stream GCD with DMA
      • Part 7: Access to DDR from PL
    • ZYNQ FPGA Tutorial
      • Part 1: Gate-Level Combinational Circuit
      • Part 2: RT-Level Combinational Circuit
      • Part 3: Regular Sequential Circuit
      • Part 4: FSM Sequential Circuit
      • Part 5: ZYNQ Architecture
      • Part 6: ARM CPU and FPGA Module
      • Part 7: FPGA Memory
      • Part 8: Hardware Accelerator for Neural Networks
    • ZYNQ FPGA Linux Kernel Module
      • Cross Compiling Kernel, Kernel Module, and User Program for PYNQ
      • Configure PL to PS Interrupt in Kernel Module
      • Configure AXI DMA in Kernel Module
  • 📟Proyek Arduino
    • Kumpulan Proyek
      • Rangkaian LED
      • LED Berkedip Nyala Api
      • LED Chaser
      • LED Binary Counter
      • OLED 128x4 Bitcoin Ticker
      • Rangkaian Button
      • Button Multifungsi
      • Button Interrupt
      • Button Debouncing
    • Pelatihan Mikrokontroler Arduino ESP32
      • Bab 1 Pengenalan Mikrokontroler
      • Bab 2 Pengenalan Arduino
      • Bab 3 Pengenalan Bahasa C
      • Bab 4 Digital Output
      • Bab 5 Digital Input
      • Bab 6 Serial Communication
      • Bab 7 Analog-to-Digital Conversion
      • Bab 8 Interrupt
      • Bab 9 Timer
      • Bab 10 Pulse-Width Modulation
      • Bab 11 SPI Communication
      • Bab 12 I2C Communication
  • 💰Finance
    • Coding for Finance
      • Build a Bitcoin Price Alert with Google Cloud and Telegram
      • Build a Bitcoin Ticker with ESP32 and Arduino
      • Stock Price Forecasting with LSTM
    • Trading dan Investasi
      • Istilah Ekonomi, Keuangan, Bisnis, Trading, dan Investasi
      • Jalan Menuju Financial Abundance
      • Memahami Korelasi Emas, Oil, Dollar, BTC, Bonds, dan Saham
      • Mindset Trading dan Investasi
      • Rangkuman Buku: Rahasia Analisis Fundamental Saham
      • Rangkuman Buku: The Psychology of Money
      • Rangkuman Kuliah: Introduction to Adaptive Markets
      • Rumus Menjadi Orang Kaya
  • 📝Life
    • Life Quotes
Powered by GitBook
On this page
  • Penjelasan Proyek
  • Daftar Komponen
  • Rangkaian
  • Kode Program
  • Hasil
  1. Proyek Arduino
  2. Kumpulan Proyek

LED Binary Counter

PreviousLED ChaserNextOLED 128x4 Bitcoin Ticker

Last updated 11 months ago

Penjelasan Proyek

Pada proyek ini, kita akan membuat binary counter 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.

Kode Program

Kode program yang dibuat yaitu sebagai berikut. Program akan menyalakan LED sesuai dengan nilai variable i dari perintah for loop. Delay antara nilai yaitu 100 ms. Fungsi displayBinary() digunakan untuk menyalakan 8 buah LED sesuai angka yang dimasukan.

led_binary_counter.ino
// uint8_t pin[8] = {23, 22, 1, 3, 17, 16, 4, 0}; // Right MSB
uint8_t pin[8] = {0, 4, 16, 17, 3, 1, 22, 23}; // Left MSB

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

void loop() 
{
  for (byte i = 0; i <= 255; i++)
  {
    displayBinary(i);
    delay(100);
  }
}

void displayBinary(byte numToShow)
{
  for (int i = 0; i <= 7; i++)
  {
    if (bitRead(numToShow, i) == 1)
      digitalWrite(pin[i], HIGH);
    else
      digitalWrite(pin[i], LOW);
  }
}

```

Hasil

Hasil dari proyek ini yaitu pada gambar berikut ini.

📟
proyek_arduino/led/led_binary_counter/led_binary_counter.ino at main · weenslab/proyek_arduinoGitHub
Logo