描述
技術規格:
Microcontroller ATmega328P
Operating Voltage 5V
Input Voltage (recommended) 9-12V (DC JACK)
DC Motor Control Pins 4 (2 for speed control, 2 for enable)
DC Motor External Power 5~12V (Jumper Selection)
DC Motor Drive Pins 4 (M1+, M1-, M2+, M2-)
Digital I/O Pins 12(of which 6 provide PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (2KB for bootloader)
SRAM 2 KB
EEPROM 1 KB
Clock Speed 16MHz
Bluetooth Socket 3.3V (TX/RX)
主要特性:
1. 可驅動兩顆馬達 5 ~ 12 V
2. 每channel工作電流 <= 600mA
3. PIN 5, PIN 6, PIN 10和PIN 11專門用來驅動馬達
4. 支援PWM 馬達轉速控制
5. 完全相容於Arduino UNO R3 (Atmega16U2 & Atmega328P)
6. 兩顆DC馬達正反轉LED指示燈
7. L293D IC Socket可以容易置換 IC(如果燒毀)
8. 提供獨立或共用板子電源驅動馬達
9.引出 D2 及A0腳位,可配合擴充應用(可配合S4A軟體使用)
商品內容:
1. Motoduino U1 電路板 1pcs
2. USB 線 (100cm) 1pcs
3. 板子底部保護墊 1pcs
為防止板子底部針腳刮傷手及誤觸金屬短路 特製保護墊!
範例程式:
/////////////////////////////////////////////
// 馬達與motoduino的腳位對應
const int Motor_E1 = 5; // 控制馬達1轉速 digital pin 5 of Arduino (PWM)
const int Motor_M1 = 10; // 控制馬達1正反轉 digital pin 10 of Arduino
const int Motor_E2 = 6; // 控制馬達2轉速 digital pin 6 of Arduino (PWM)
const int Motor_M2 = 11; // 控制馬達2正反轉 digital pin 11 of Arduino
void setup() {
//set up serial communications
Serial.begin(57600);
// 輸出入接腳初始設定
pinMode(Motor_M1, OUTPUT); //設定 Motor_M1為輸出腳位
pinMode(Motor_M2, OUTPUT); //設定 Motor_M2為輸出腳位
}
//////////// 主程式 ////////
void loop()
{
forward(0,255);
delay(1000);
backward(0,255);
delay(1000);
right(0, 255); // 右轉
delay(1000);
left(0, 255); // 左轉
delay(3000);
}
void motorstop(byte flag, byte motorspeed)
{
Serial.println(“stop!”);
digitalWrite( Motor_E1, motorspeed);
digitalWrite( Motor_E2, motorspeed);
}
void forward(byte flag, byte motorspeed)
{
Serial.println(“forward!”);
digitalWrite( Motor_M1, HIGH);
digitalWrite( Motor_M2, HIGH);
analogWrite( Motor_E1, motorspeed);
analogWrite( Motor_E2, motorspeed);
}
void backward(byte flag, byte motorspeed)
{
digitalWrite( Motor_M1, LOW);
digitalWrite( Motor_M2, LOW);
analogWrite( Motor_E1, motorspeed);
analogWrite( Motor_E2, motorspeed);
}
void right(byte flag, byte motorspeed)
{
Serial.println(“right!”);
digitalWrite( Motor_M1, HIGH);
digitalWrite( Motor_M2, HIGH);
analogWrite( Motor_E1, 0);
analogWrite( Motor_E2, motorspeed);
}
void left(byte flag, byte motorspeed)
{
Serial.println(“left!”);
digitalWrite( Motor_M1, HIGH);
digitalWrite( Motor_M2, HIGH);
analogWrite( Motor_E1, motorspeed);
analogWrite( Motor_E2, 0);
}