บทความประกอบการเรียนรู้ => ไมโครคอนโทรลเลอร์ (Arduino) => ข้อความที่เริ่มโดย: admin ที่ พฤษภาคม 02, 2014, 10:00:57 AM

หัวข้อ: งานครั้งที่ 28 เขียนโปรแกรมควบคุม RC Servo Motor ด้วยสวิตช์
เริ่มหัวข้อโดย: admin ที่ พฤษภาคม 02, 2014, 10:00:57 AM
เขียนโปรแกรมควบคุม RC Servo Motor ด้วยสวิตช์
ฟังก์ชั่นที่ใช้งานกลุ่ม Servo http://arduino.cc/en/Reference/Servo (http://arduino.cc/en/Reference/Servo)
-attached() http://arduino.cc/en/Reference/ServoAttached (http://arduino.cc/en/Reference/ServoAttached)
-write() http://arduino.cc/en/Reference/ServoWrite (http://arduino.cc/en/Reference/ServoWrite)
**ไลบารี่ Servo.h ไม่ต้องดาวน์โหลดใหม่เนื่องจากมีมาพร้อมใน Arduino IDE อยู่แล้ว

ฟังก์ชั่นทั่วไป
-pinMode() http://arduino.cc/en/Reference/PinMode (http://arduino.cc/en/Reference/PinMode)
-delay() http://arduino.cc/en/Reference/Delay (http://arduino.cc/en/Reference/Delay)
-digitalRead() http://arduino.cc/en/Reference/DigitalRead (http://arduino.cc/en/Reference/DigitalRead)

โจทย์โปรแกรม
-เขียนโปรแกรมควบคุมการหมุนของมอเตอร์ด้วยสวิตช์
-โปรแกรมรายละเอียดพิเศษรายกลุ่ม (แจ้งให้ทราบเมื่อถึงชั่วโมงเรียน)


วงจรที่ใช้ในการทดลองสำหรับผู้ที่ใช้บอร์ด Arduino
(http://www.praphas.com/PhotoForum/arduino/Lab-28-01.png)

วงจรที่ใช้ในการทดลองสำหรับผู้ที่ใช้ไอซี ATmega328 (ที่มี Boot Loader Arduino)
(http://www.praphas.com/PhotoForum/arduino/Lab-28-02.png)

บริเวณใช้งานบอร์ดทดลอง
(http://www.praphas.com/PhotoForum/arduino/Lab-28-03.png)

โมดูลสำเร็จรูปเพิ่มเติม
-Futaba S3003 Servo Motor
(http://www.praphas.com/PhotoForum/arduino/Lab-27-a.jpg)
http://www.arduinoall.com (คลิก) (http://www.arduinoall.com/product/114/futaba-s3003-servo-motor-s3003-servo-motor-38g-s3003-standard-servo)