หัวใจที่เต้น

beating heart Arduino UNO

หัวใจที่เต้น: อาร์ดูอีโน่ Uno R3, 8x8 ดอทเมทริกซ์

สวัสดีผู้ที่ชื่นชอบวิทยาศาสตร์! พร้อมที่จะส่องแสงให้กับโลกของคุณด้วยอาร์ดูอีโน่หรือยัง? มาลุยกับโปรเจกต์สุดตื่นเต้นที่รวมศิลปะและเทคโนโลยีเข้าด้วยกัน—การแสดงหัวใจเต้นบนจอ LED เมทริกซ์ด้วยอาร์ดูอีโน่ โปรเจกต์สนุกๆ นี้จะสอนคุณวิธีสร้างภาพเคลื่อนไหวของหัวใจบนจอ LED เมทริกซ์ ซึ่งเป็นสัญลักษณ์ของการเต้นที่เต็มไปด้วยความรัก มาเริ่มสร้างการแสดงที่อบอุ่นนี้ทีละขั้นตอนกันเถอะ!

วัสดุที่คุณต้องใช้:

  • อาร์ดูอีโน่ Uno: สมองกลางของจอแสดงผลของเรา
  • จอ LED เมทริกซ์: ตะแกรงของ LED (8×8) เพื่อแสดงหัวใจของเรา
  • เรซิสเตอร์:: เพื่อลดกระแสไฟฟ้าผ่าน LED และป้องกันพวกมัน, 8 x 220 โอห์ม
  • Jumper Wires: เพื่อเชื่อมต่อทุกอย่างเข้าด้วยกัน
  • แผ่นทดลองวงจร (เบรดบอร์ด): สำหรับการทดลองสร้างวงจรได้ง่ายโดยไม่ต้องบัดกรี

ขั้นตอนที่ 1: เชื่อมต่อฮาร์ดแวร์

มาเริ่มกันด้วยการเชื่อมต่ออุปกรณ์อิเล็กทรอนิกส์ของเรา—ความแม่นยำเป็นสิ่งสำคัญ!

  • ตั้งค่าจอ LED เมทริกซ์:

    • Connect the rows (R[]) of the matrix to Arduino Digital Pins 2 through 9.
    • Connect the columns (C[]) of the matrix to Arduino Digital Pins 10 through 17.
  • การวางตัวต้านทาน:

    • วางตัวต้านทานบนการเชื่อมต่อแต่ละคอลัมน์เพื่อลดกระแสไฟฟ้าและป้องกันไม่ให้ LED ของคุณเสียหาย

Note: ตรวจสอบการเชื่อมต่อแต่ละจุดอีกครั้งเพื่อให้แน่ใจว่าทุกอย่างถูกวางอย่างถูกต้องและมั่นคง

fritzing wiring diagram for Arduino UNO and 4 digit 7 segment LED

ขั้นตอนที่ 2: เวลาเขียนโค้ด!

ถึงเวลาที่จะทำให้หัวใจ LED ของเรามีชีวิตขึ้นมาแล้ว

  • เปิดโปรแกรม Arduino IDE ของคุณ:

    • เปิดโปรแกรม Arduino IDE บนคอมพิวเตอร์ของคุณ
  • เขียนโค้ด:

    • เริ่มต้นโดยการกำหนดการตั้งค่าขาของคุณและเริ่มต้นขาใน setup() function.
    • สร้างฟังก์ชัน Display() สำหรับการเปิดไฟในเมทริกซ์และ Clear() สำหรับการปิดไฟ LED ทั้งหมด เพื่อให้แน่ใจว่าการเปลี่ยนแปลงระหว่างภาพเคลื่อนไหวเป็นไปอย่างราบรื่น
    • ใช้อาเรย์ bigHeart and smallHeart เพื่อกำหนดรูปร่างของหัวใจในรูปแบบไบนารี, ซึ่ง 1 turns on an LED, and 0 turns it off.
  • Upload the Code:

    • Connect your Arduino to your computer using the USB cable.
    • Select the correct board and port from the Tools menu.
    • Click the Upload button.

Step 3: Test Your Heart Display!

Now, let’s see the heart beat!

  • Power Up Your Arduino:

    • Connect your Arduino to a power source (via USB cable or external battery).
  • Watch the Magic:

    • The LED matrix should start displaying big and small hearts alternately, creating a pulsating effect.
    • Adjust the delays in the Display() function if the animation is too fast or too slow.

🌟 Voilà! Your Heartbeat LED Matrix Display is Alive! 🌟

Troubleshooting Tips:

    • No Lights on the Matrix? Check your wiring, especially the connections to Arduino.
    • Random LEDs Lighting Up? Ensure there are no short circuits in your breadboard setup.
    • Animation Issues? Double-check the logic in your loop and display functions to ensure they cycle through the patterns correctly.

     

Congratulations, you’ve just made a beating heart display! This project not only lights up LEDs but also brightens anyone’s day with its charming patterns. As David Suzuki reminds us, ‘We’re all interconnected. For example, every breath we take contains billions of atoms that we share with all other living beings.’ In the world of electronics and coding, remember that the possibilities are endless—keep experimenting, keep learning, and most importantly, keep enjoying the wonderful interconnectedness of science!

แสดงความคิดเห็น

อีเมลของคุณจะไม่แสดงให้คนอื่นเห็น ช่องข้อมูลจำเป็นถูกทำเครื่องหมาย *

thThai