งานที่มอบหมาย ครูประภาส

บทความประกอบการเรียนรู้ => ไมโครคอนโทรลเลอร์ (Arduino) => ข้อความที่เริ่มโดย: admin ที่ กุมภาพันธ์ 19, 2015, 02:32:51 PM

หัวข้อ: งานครั้งที่ 30 เขียนโปรแกรมควบคุม RC Servo Motor ด้วยจอยสติ๊ก
เริ่มหัวข้อโดย: admin ที่ กุมภาพันธ์ 19, 2015, 02:32:51 PM
เขียนโปรแกรมควบคุม RC Servo Motor 2 ตัว ด้วยจอยสติ๊ก 2 แกน
ฟังก์ชั่นที่ใช้ในกลุ่ม 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)

ฟังก์ชั่นทั่วไป
-pinMode() http://arduino.cc/en/Reference/PinMode (http://arduino.cc/en/Reference/PinMode)
-digitalWrite() http://arduino.cc/en/Reference/DigitalWrite (http://arduino.cc/en/Reference/DigitalWrite)
-delay() http://arduino.cc/en/Reference/Delay (http://arduino.cc/en/Reference/Delay)
-delayMicroseconds() http://arduino.cc/en/Reference/DelayMicroseconds (http://arduino.cc/en/Reference/DelayMicroseconds)
-analogRead() http://arduino.cc/en/Reference/AnalogRead (http://arduino.cc/en/Reference/AnalogRead)
-map() http://arduino.cc/en/Reference/Map (http://arduino.cc/en/Reference/Map)

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

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

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

บริเวณใช้งานบอร์ดทดลอง
(http://www.praphas.com/PhotoForum/arduino/Lab-30-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)

-XY Joystick Module
(http://www.praphas.com/PhotoForum/arduino/Lab-30-b.jpg)
http://www.arduinoall.com (คลิก) (http://www.arduinoall.com/product/308/xy-joystick-module)