上回講到透過 PL2303 Mini USB to TTL UART Communication Module Board,終於可以連接電腦編寫程式了。
硬件的接駁方法可參考上回 http://www.jasonworkshop.com/2016/11/20161107.html
今次主要是講如何將編寫好的程式寫入 Servo Control Board。
由於 Jason 未完成機械人的新程式,暫時會借用 MiniPlan (http://www.miniplan.co) 的程式作示範。
首先要準備一下材料:
1. 兼容 PCA9685 PWM Servo Driver 的 Servo Control Board / Servo Controller 之類的東西(很多不同的叫法)。
2. PL2303 Mini USB to TTL UART Communication Module Board。
硬件準備好之後,就開始準備相關的軟件部份哦!
1. 安裝 Arduino:
機械人的程式以 Arduino IDE 編寫,先到 http://www.arduino.cc/en/Main/Software下載最新版本的 Arduino IDE,並安裝至電腦。

2. 在 Arduino 加入對 ESP8266 WiFi Module 的支援:
進入 Arduino\Preferences,在 Additional Boards Manager URLs 輸入 http://arduino.esp8266.com/stable/package_esp8266com_index.json,然後按 OK。

進入 Arduino\Tools\Board\Boards Manager,選擇並安裝 esp8266 package。

成功安裝後,Arduino\Tools\Board 便可以選擇 Generic ESP8266 Module。

Flash Size 請選擇 1M (512K SPIFFS)

3. 安裝 Adafruit PWM Servo Driver Library (Servo Control Board 所需程式庫)
先到 http://github.com/adafruit/Adafruit-PWM-Servo-Driver-Library 下載 Adafruit-PWM-Servo-Driver-Library.zip
然後在 Arduino\Sketch\Include Library\Add .ZIP Library,並選擇加入剛才下載的 .zip 檔。

4. 安裝 PL2303 Mini USB to TTL UART Communication Module Board Driver
請到 http://www.prolific.com.tw/US/ShowProduct.aspx?pcid=41&showlevel=0041-0041 下載並安裝最新版本的驅動程式。
安裝完、重新啟動電腦之後,就可以將 PL2303 連接到電腦,然後在 Arduino\Tools\Port\ 就會發現新增了可用的 Port。

機械人的 Firmware 可以 按此下載
最後提提大家,在寫入程式之前,請將 Servo Control Board 由「執行模式」切換為「寫入模式」呀!
硬件的接駁方法可參考上回 http://www.jasonworkshop.com/2016/11/20161107.html
今次主要是講如何將編寫好的程式寫入 Servo Control Board。
由於 Jason 未完成機械人的新程式,暫時會借用 MiniPlan (http://www.miniplan.co) 的程式作示範。
首先要準備一下材料:
1. 兼容 PCA9685 PWM Servo Driver 的 Servo Control Board / Servo Controller 之類的東西(很多不同的叫法)。
2. PL2303 Mini USB to TTL UART Communication Module Board。
硬件準備好之後,就開始準備相關的軟件部份哦!
1. 安裝 Arduino:
機械人的程式以 Arduino IDE 編寫,先到 http://www.arduino.cc/en/Main/Software下載最新版本的 Arduino IDE,並安裝至電腦。

2. 在 Arduino 加入對 ESP8266 WiFi Module 的支援:
進入 Arduino\Preferences,在 Additional Boards Manager URLs 輸入 http://arduino.esp8266.com/stable/package_esp8266com_index.json,然後按 OK。

進入 Arduino\Tools\Board\Boards Manager,選擇並安裝 esp8266 package。

成功安裝後,Arduino\Tools\Board 便可以選擇 Generic ESP8266 Module。

Flash Size 請選擇 1M (512K SPIFFS)

3. 安裝 Adafruit PWM Servo Driver Library (Servo Control Board 所需程式庫)
先到 http://github.com/adafruit/Adafruit-PWM-Servo-Driver-Library 下載 Adafruit-PWM-Servo-Driver-Library.zip
然後在 Arduino\Sketch\Include Library\Add .ZIP Library,並選擇加入剛才下載的 .zip 檔。

4. 安裝 PL2303 Mini USB to TTL UART Communication Module Board Driver
請到 http://www.prolific.com.tw/US/ShowProduct.aspx?pcid=41&showlevel=0041-0041 下載並安裝最新版本的驅動程式。
安裝完、重新啟動電腦之後,就可以將 PL2303 連接到電腦,然後在 Arduino\Tools\Port\ 就會發現新增了可用的 Port。

機械人的 Firmware 可以 按此下載
最後提提大家,在寫入程式之前,請將 Servo Control Board 由「執行模式」切換為「寫入模式」呀!