google只找到一些購物網站,只有普通簡介,完全沒有講細節
上面主要有兩種chip:
- 74HCT595N *1
- 計數器轉換暫存器
- 相關連結
- L293D *2
- 每棵可控制兩顆直流馬達或是一顆四線式步進馬達
- 相關連結
MTADRL293D主要功能:
- RESET
- 與Arduino 的RESET接在一起
- POWER JUMP
- 接上代表MTADRL293D的電池同時供電給arduino
- 電池正極(V+)接到Arduino VIN(Arduino內部可以自己轉成5V VCC)
- 兩路servo控制(只是幫忙轉換腳位,實際上還是使用Arduino 輸出的PWM控制)
- servo 1:直接接到Arduino pin 10
- servo 2:直接接到Arduino pin 9
- servo VCC: Arduino 5V <==不是直接接到MTADRL293D的BATT,或是由他降壓
- 四路馬達控制:
- M1
- EN: (PWM2A) 接到Arduino pin 11
- 電源: V+
- M2
- EN: (PWM2B) 接到Arduino pin 3
- 電源: V+
- M4
- EN: (PWM0B) 接到Arduino pin 5
- 電源: V+
- M3
- EN: (PWM0A) 接到Arduino pin 6
- 電源: V+
- 兩路四線式步進馬達控制
- 待續...
控制範例:
#include "MTADRL293D.h" MTADRL293D l293d; void setup(){ Serial.begin(115200); while (!Serial){ ; } delay(5000); Serial.println("=== loop() ==="); l293d.enableDbg(true); l293d.begin(); l293d.setMotorDir(MTADRL293D_M1, MTADRL293D_DIR_POS); l293d.setMotorDir(MTADRL293D_M2, MTADRL293D_DIR_POS); l293d.setMotorDir(MTADRL293D_M3, MTADRL293D_DIR_POS); l293d.setMotorDir(MTADRL293D_M4, MTADRL293D_DIR_POS); l293d.setMinMotorSpeed(MTADRL293D_M1, 100); l293d.setMinMotorSpeed(MTADRL293D_M2, 100); l293d.setMinMotorSpeed(MTADRL293D_M3, 100); l293d.setMinMotorSpeed(MTADRL293D_M4, 100); l293d.setMotorSpeed(MTADRL293D_M1, 0); l293d.setMotorSpeed(MTADRL293D_M2, 0); l293d.setMotorSpeed(MTADRL293D_M3, 0); l293d.setMotorSpeed(MTADRL293D_M4, 0); } void loop(){ Serial.println("=== loop() ==="); Serial.println("=== m1 pos 100"); l293d.setMotorDir(MTADRL293D_M1, MTADRL293D_DIR_POS); l293d.setMotorSpeed(MTADRL293D_M1, 100); delay(3000); Serial.println("=== m1 0"); l293d.setMotorSpeed(MTADRL293D_M1, 0); delay(1000); Serial.println("=== m1 neg 100"); l293d.setMotorDir(MTADRL293D_M1, MTADRL293D_DIR_NEG); l293d.setMotorSpeed(MTADRL293D_M1, 100); delay(3000); Serial.println("=== m1 0"); l293d.setMotorSpeed(MTADRL293D_M1, 0); delay(1000); Serial.println("=== m3 pos 100"); l293d.setMotorDir(MTADRL293D_M3, MTADRL293D_DIR_POS); l293d.setMotorSpeed(MTADRL293D_M3, 100); delay(3000); Serial.println("=== m3 0"); l293d.setMotorSpeed(MTADRL293D_M3, 0); delay(1000); Serial.println("=== m3 neg 100"); l293d.setMotorDir(MTADRL293D_M3, MTADRL293D_DIR_NEG); l293d.setMotorSpeed(MTADRL293D_M3, 100); delay(3000); Serial.println("=== m3 0"); l293d.setMotorSpeed(MTADRL293D_M3, 0); delay(1000); }
沒有留言:
張貼留言