รหัสสินค้า | AT07023B |
หมวดหมู่ | Motor Drive |
ราคา | 200.00 บาท |
ลงสินค้า | 28 ก.ย. 2557 |
อัพเดทล่าสุด | 21 ก.ค. 2564 |
บอร์ดขับมอเตอร์สำหรับ Arduino UNO R3/Arduino Mega 2560 30A Single Channel Motor Driver (ใช้ชิป VNH2SP30)
Features
Specifications
ตัวอย่างการใช้งาน
PWM: Value between "0" and "255" to control the speed of the motor
#define BRAKE 0
#define CW 1
#define CCW 2
#define CS_THRESHOLD 15 // Definition of safety current (Check: "1.3 Monster Shield Example").
//MOTOR 1
#define MOTOR_A1_PIN 7 //Driver Board IN1
#define MOTOR_B1_PIN 8 //Driver Board IN2
#define PWM_MOTOR_1 5 //Driver Board PWM
#define EN_PIN_1 A0 //Driver Board EN
#define MOTOR_1 0
short usSpeed = 150; //default motor speed
unsigned short usMotor_Status = BRAKE;
void setup()
{
pinMode(MOTOR_A1_PIN, OUTPUT);
pinMode(MOTOR_B1_PIN, OUTPUT);
pinMode(PWM_MOTOR_1, OUTPUT);
pinMode(EN_PIN_1, OUTPUT);
Serial.begin(9600); // Initiates the serial to do the monitoring
Serial.println("Begin motor control");
Serial.println(); //Print function list for user selection
Serial.println("Enter number for control option:");
Serial.println("1. STOP");
Serial.println("2. FORWARD");
Serial.println("3. REVERSE");
Serial.println("4. READ CURRENT");
Serial.println("+. INCREASE SPEED");
Serial.println("-. DECREASE SPEED");
Serial.println();
}
void loop()
{
char user_input;
while(Serial.available())
{
user_input = Serial.read(); //Read user input and trigger appropriate function
digitalWrite(EN_PIN_1, HIGH);
if (user_input =='1')
{
Stop();
}
else if(user_input =='2')
{
Forward();
}
else if(user_input =='3')
{
Reverse();
}
else if(user_input =='+')
{
IncreaseSpeed();
}
else if(user_input =='-')
{
DecreaseSpeed();
}
else
{
Serial.println("Invalid option entered.");
}
}
}
void Stop()
{
Serial.println("Stop");
usMotor_Status = BRAKE;
motorGo(MOTOR_1, usMotor_Status, 0);
}
void Forward()
{
Serial.println("Forward");
usMotor_Status = CW;
motorGo(MOTOR_1, usMotor_Status, usSpeed);
}
void Reverse()
{
Serial.println("Reverse");
usMotor_Status = CCW;
motorGo(MOTOR_1, usMotor_Status, usSpeed);
}
void IncreaseSpeed()
{
usSpeed = usSpeed + 10;
if(usSpeed > 255)
{
usSpeed = 255;
}
Serial.print("Speed +: ");
Serial.println(usSpeed);
motorGo(MOTOR_1, usMotor_Status, usSpeed);
}
void DecreaseSpeed()
{
usSpeed = usSpeed - 10;
if(usSpeed < 0)
{
usSpeed = 0;
}
Serial.print("Speed -: ");
Serial.println(usSpeed);
motorGo(MOTOR_1, usMotor_Status, usSpeed);
}
void motorGo(uint8_t motor, uint8_t direct, uint8_t pwm) //Function that controls the variables: motor(0 ou 1), direction (cw ou ccw) e pwm (entra 0 e 255);
{
if(motor == MOTOR_1)
{
if(direct == CW)
{
digitalWrite(MOTOR_A1_PIN, LOW);
digitalWrite(MOTOR_B1_PIN, HIGH);
}
else if(direct == CCW)
{
digitalWrite(MOTOR_A1_PIN, HIGH);
digitalWrite(MOTOR_B1_PIN, LOW);
}
else
{
digitalWrite(MOTOR_A1_PIN, LOW);
digitalWrite(MOTOR_B1_PIN, LOW);
}
analogWrite(PWM_MOTOR_1, pwm);
}
}
Upload and open the “Serial Monitor” in Arduino IDE and command.
ค่าจัดส่งสินค้า ยอดสั่งซื้อต่ำกว่า 1000 บาท ค่าจัดส่งทาง EMS 50 บาท
ยอดสั่งซื้อ 1500 บาทขึ้นไป จัดส่งให้ฟรีทาง Kerry
(ไม่รวมสินค้าหมวดหมู่DIY)
หลังจากสั่งซื้อและชำระเงินแล้ว จะต้องแจ้งชำระเงินทางหน้าเว็บเท่านั้น หากไม่มีการแจ้งชำระเงินภายใน 72 ชม. ระบบจะยกเลิกคำสั่งซื้อโดยอัตโนมัติ หากท่านยังต้องการสั่งซื้อสินค้าอยู่ จะต้องทำการสั่งซื้อใหม่อีกครั้ง
รายการที่แจ้งชำระเงินก่อนเวลา 15:00น. จะทำการจัดส่งในวันทำการเดียวกัน รายการที่แจ้งชำระเงินหลัง 15:00น. จะจัดส่งในวันทำการถัดไป จะทำการจัดส่งทุกวัน จันทร์-ศุกร์
***เฉพาะบริการจัดส่งKerryแจ้งยอดชำระก่อนเวลา10:30น. จะจัดส่งในวันทำการเดียวกัน
Kerryจัดส่งวันจันทร์-ศุกร์เท่านั้น
*เฉพาะวันเสาร์ รายการที่แจ้งชำระเงินก่อนเวลา 10:00น. จะทำการจัดส่งในวันทำการเดียวกัน รายการที่แจ้งชำระเงินหลัง 10:00น. จะจัดส่งในวันทำการถัดไป
หลังจากชำระเงินแล้ว คลิ๊กที่นี่ เพิ่อแจ้งชำระเงินทันที หากไม่สะดวกในการแนบหลักฐานการโอนเงิน กรุณาแจ้งชื่อธนาคาร และเวลาโอนเงินที่ถูกต้อง หากไม่สะดวกในการเข้าหน้าเว็บจริงๆ สามารถส่งหลักฐานการโอนเงินมาได้ทาง Official Line ID : @analogread
2.ชำระเงินผ่าน QR-CODE ฟรีค่าธรรมเนียม ทุกกรณี
เลือกช่องทางที่คุณสะดวก เพื่อชำระเงินให้ร้านค้าโดยตรง หากมีข้อสงสัย กรุณา ติดต่อเรา
เลือกช่องทางที่คุณสะดวก เมื่อชำระเงินเรียบร้อย คุณจะได้รับอีเมลยืนยันการชำระเงินทุกครั้ง (LnwPay ไม่มีค่าธรรมเนียมเพิ่มเติม อ่านรายละเอียด)
หน้าที่เข้าชม | 7,125,785 ครั้ง |
ผู้ชมทั้งหมด | 2,822,683 ครั้ง |
เปิดร้าน | 15 ก.ย. 2557 |
ร้านค้าอัพเดท | 6 ก.ย. 2568 |