From 6eb77fdf18616f79f99f2a57eed40d3b7a55eaa5 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Mon, 2 Jan 2017 09:24:18 +0100 Subject: Initial import --- .../right_wheel_rotation/right_wheel_rotation.ino | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 Lesson 1 Make The Car Move/right_wheel_rotation/right_wheel_rotation.ino (limited to 'Lesson 1 Make The Car Move/right_wheel_rotation') diff --git a/Lesson 1 Make The Car Move/right_wheel_rotation/right_wheel_rotation.ino b/Lesson 1 Make The Car Move/right_wheel_rotation/right_wheel_rotation.ino new file mode 100755 index 0000000..766573c --- /dev/null +++ b/Lesson 1 Make The Car Move/right_wheel_rotation/right_wheel_rotation.ino @@ -0,0 +1,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); +} + -- cgit v1.2.3