簡介

Introduction: 簡介

本教程改編自此網址作者https://www.instructables.com/Arduino-LED-Chaser-With-5-Effects-/

在這個教程中,我將向您解釋如何在arduino的幫助下製作LED追光燈。在這個led追踪器中,我添加了5種模式。請按照以下步驟製作arduino LED跟踪器。

Step 1: 需準備

1.麵包板x12。ArduinoLEONARDO x1 LED x9跨接電纜x 10

(注意:為提高LED的安全性,您可以添加電阻器)

Step 2: 電路連接

1.根據電路圖在麵包板上添加LED,將所有LED雙向端子連接到麵包板的串口端口上2.我以這種方式添加LEDRGBRGBRGB,但是您可以根據自己的選擇添加LED。3。現在,將跳線電纜連接到每個LED的4.00,現在,取arduino連接這些跳線電纜的第二個端子與arduino的數字指針1至9相連。(為了使您的LED更安全,您可以將電阻器連接到LED的瞬態,然後可以通過跨接電纜將其連接到arduino的數字指針)。5。將arduino的接地引腳與所有LED的短路。我們的電路連接完成

Step 3: 編程

直接在計算機中打開arduino IDE軟件。現在復制此代碼並對其插入到arduino IDE中。

或下載.ino文件並在arduino IDE中打開避免設置(){pinMode(1,OUTPUT); pinMode(2,輸出); pinMode(3,輸出); pinMode(4,輸出); pinMode(5,輸出) ; pinMode(6,輸出); pinMode(7,輸出); pinMode(8,輸出); pinMode(9,輸出);}無效循環(){int i; //第一個模式重複1次,(i = 1;我<= 10; i ++){digitalWrite(i,HIGH);延遲(50); digitalWrite(i,LOW);延遲(50);}為(i = 10;i> = 1;i-){digitalWrite(i,HIGH);延遲(50); digitalWrite(i,LOW);延遲(50);}延遲(1000); //第二個模式重複1次(i = 1;我<= 10; i ++){digitalWrite(i,HIGH);延遲(50);}用於(i = 1;我<= 10; i ++){digitalWrite(i,LOW);延遲(50);}為(i = 10;i> = 1;i-){digitalWrite(i,HIGH);延遲(50);}用於(i = 10;i> = 1;i-){digitalWrite(i,LOW);延遲(50);}延遲(1000); //對於(i = 1;我<= 10;i ++)第3個模式重複1次{digitalWrite(i,HIGH);延遲(50);}用(i = 11;i> = 1;i-){digitalWrite(i,LOW);延遲(50);}為(i = 10;i> = 1;i-){digitalWrite(i,HIGH);延遲(50);}用於(i = 1;我<= 10; i ++){digitalWrite(i,LOW);延遲(50);}延遲(1000); //對於(i = 1;我<= 5; i ++){digitalWrite(i,HIGH); digitalWrite(11-i,HIGH);延遲(100);}為(i = 1;我<= 5;i ++){digitalWrite(i,LOW); digitalWrite(11-i,LOW);延遲(100);}延遲(100);對於(i = 1;我<= 5; i ++){digitalWrite(i,HIGH); digitalWrite(11-i,HIGH);延遲(100);}為(i = 5;i> = 1;i-){digitalWrite(i,LOW); digitalWrite(11-i,LOW);延遲(100);}延遲(1000); //第5個圖案重複1次,使用(i = 1;我<= 3;i ++){digitalWrite(i,HIGH); digitalWrite(i + 3,HIGH); digitalWrite(i + 6,HIGH);延遲(500 / i);}延遲(500);對於(i = 1;我<= 3; i ++){digitalWrite(i,LOW); digitalWrite(i + 3,LOW); digitalWrite(i + 6,LOW);延遲(500 / i);}延遲(1000);}現在,在您的Arduino板上傳這些代碼}延遲(100);對於(i = 1;我<= 5; i ++){digitalWrite(i,HIGH); digitalWrite(11-i,HIGH);延遲(100);}為(i = 5;i> = 1;i-){digitalWrite(i,LOW); digitalWrite(11-i,LOW);延遲(100);}延遲(1000); //第5個圖案重複1次,使用(i = 1;我<= 3; i ++){digitalWrite(i,HIGH); digitalWrite(i + 3,HIGH); digitalWrite(i + 6,HIGH);延遲(500 / i);}延遲(500);對於(i = 1;我<= 3; i ++){digitalWrite(i,LOW); digitalWrite(i + 3,LOW); digitalWrite(i + 6,LOW);延遲(500 / i);}延遲(1000);}現在,在您的Arduino板上傳這些代碼}延遲(100);對於(i = 1;我<= 5; i ++){digitalWrite(i,HIGH); digitalWrite(11-i,HIGH);延遲(100);}為(i = 5;i> = 1;i-){digitalWrite(i,LOW); digitalWrite(11-i,LOW);延遲(100);}延遲(1000); //第5個圖案重複1次,使用(i = 1;我<= 3; i ++){digitalWrite(i,HIGH); digitalWrite(i + 3,HIGH); digitalWrite(i + 6,HIGH);延遲(500 / i);}延遲(500);對於(i = 1;我<= 3; i ++){digitalWrite(i,LOW); digitalWrite(i + 3,LOW); digitalWrite(i + 6,LOW);延遲(500 / i);}延遲(1000);}現在,在您的Arduino板上傳這些代碼

Step 4:

Be the First to Share

    Recommendations

    • Jewelry Challenge

      Jewelry Challenge
    • Raspberry Pi Contest

      Raspberry Pi Contest
    • New Year, New Skill Student Design Challenge

      New Year, New Skill Student Design Challenge

    3 Comments

    0
    StumpChunkman
    StumpChunkman

    1 year ago

    Very cool! Thanks for sharing.