aboutsummaryrefslogtreecommitdiff
path: root/doc/Lesson 1 Make The Car Move/right_wheel_rotation/right_wheel_rotation.ino
blob: 766573c3738077f44ed89b92b5f0baf7e314a6b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//www.elegoo.com
//2016.09.12

/*In1 connected to the 9 pin, 
 In2 connected to the 8 pin, ENA pin 10,*/
int ENA=10; 
int IN1=9;
int IN2=8;
void setup()
{
  pinMode(IN1,OUTPUT);
  pinMode(IN2,OUTPUT);
  pinMode(ENA,OUTPUT);
  digitalWrite(ENA,HIGH);       
}
void loop()
{  
  digitalWrite(IN1,LOW);      
  digitalWrite(IN2,HIGH);        //Right wheel forward
  delay(500);
  digitalWrite(IN1,LOW);      
  digitalWrite(IN2,LOW);         //Right wheel stop
  delay(500);
  digitalWrite(IN1,HIGH);      
  digitalWrite(IN2,LOW);         //Right wheel back
  delay(500);
  digitalWrite(IN1,LOW);      
  digitalWrite(IN2,LOW);         //Right wheel stop
  delay(500);
}