---
# System prepended metadata

title: 'test: 移動'

---

<h1><i>test:</i> 移動</h1>

```arduino=
int ENA = 9;
int ENB = 3;  
int IN1 = 7;
int IN2 = 6;
int IN3 = 5;
int IN4 = 4;

void setup () {
   pinMode(ENA, OUTPUT);
   pinMode(ENB, OUTPUT);
   pinMode(IN1, OUTPUT);
   pinMode(IN2, OUTPUT);
   pinMode(IN3, OUTPUT);
   pinMode(IN4, OUTPUT);
}
void loop () {
    analogWrite (ENA, 255);
    analogWrite (ENB, 255);

  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);
  //向前
  delay(5000);
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, HIGH); 
  digitalWrite(IN4, LOW);
  //向後
  delay(5000);
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);
  //以左輪為轉軸
  delay(5000);
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);
  //以中心為轉軸
  delay(5000);
  }
```