# 兩路L9110S馬達模組

![](/files/-Lwvp3XrqKeMwJfsI8F5)

## 專案說明

使用「科易KEYES Arduino UNO R3 開發板」連接「兩路L9110S馬達模組」, 每2秒鐘轉動馬達一次。

此**兩路L9110S馬達模組**包含於「[洞洞兩教學材料包 Education Kit 002](https://www.robotkingdom.com.tw/product/rk-education-kit-002/)」內。

## KEYES Arduino UNO R3電路圖

* [KEYES Arduino UNO R3](https://www.robotkingdom.com.tw/product/keyes-uno-r3/)&#x20;
* 通用型彩色Sensor shield v5.0感測器擴充板
* 兩路L9110S馬達模組
* 微型N20直流減速馬達

**兩路L9110S馬達模組**是PWM訊號輸出， 可以接「D3、D5、D6、D9、D10」的 KEYES Arduino UNO R3訊號端上。 本範例連接到「**D5**」**←→**「**A-IA**」，「**D6**」**←→**「**A-IB**」，「**D9**」**←→**「**B-IA**」，「**D10**」**←→**「**B-IB**」

![](/files/-LxKGRpTsR1GzvG0s-Pr)

## Arduino 程式

5號、6號接MOTOR-A，9號、10號接接MOTOR-B。將5號、6號、9號、10號腳位的依序給不同的PWM訊號，每2秒鐘轉動馬達不同方向一次。

產生出的 Arduino 程式如下

```c
void setup() {
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
}

void loop() {
  analogWrite(5,0);
  analogWrite(6,255);
  analogWrite(9,0);
  analogWrite(10,255);
  delay(2000);
  stop();

  analogWrite(5,255);
  analogWrite(6,0);
  analogWrite(9,255);
  analogWrite(10,0);
  delay(2000);
  stop();

  analogWrite(5,0);
  analogWrite(6,255);
  analogWrite(9,255);
  analogWrite(10,0);
  delay(2000);
  stop();

  analogWrite(5,255);
  analogWrite(6,0);
  analogWrite(9,0);
  analogWrite(10,255);
  delay(2000);
  stop();
}

void stop() {
  analogWrite(5,0);
  analogWrite(6,0);
  analogWrite(9,0);
  analogWrite(10,0);
  delay(2000);
}

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cavedu.gitbook.io/cavedu/rk002/module/002_l9110s_motor.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
