From 6eb77fdf18616f79f99f2a57eed40d3b7a55eaa5 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Mon, 2 Jan 2017 09:24:18 +0100 Subject: Initial import --- Lesson 1 Make The Car Move/AUTO_GO_/AUTO_GO_.ino | 77 +++++++++++++++++++++ Lesson 1 Make The Car Move/Make The Car Move.pdf | Bin 0 -> 1806123 bytes .../9g steering gear.doc | Bin 0 -> 85315 bytes .../Arduino_Sensor_Shield_V5.doc | Bin 0 -> 1608704 bytes .../Module specification document/HC-06.pdf | Bin 0 -> 639451 bytes .../Infrared remote controller.doc | Bin 0 -> 609792 bytes .../Module specification document/L298N.doc | Bin 0 -> 1141760 bytes .../Module specification document/UNO.docx | Bin 0 -> 630837 bytes .../ultrasonic ranging modules_HC-SR04.doc | Bin 0 -> 1007616 bytes .../forward_back/forward_back.ino | 59 ++++++++++++++++ .../left_wheel_rotation/left_wheel_rotation.ino | 31 +++++++++ .../right_wheel_rotation/right_wheel_rotation.ino | 31 +++++++++ 12 files changed, 198 insertions(+) create mode 100755 Lesson 1 Make The Car Move/AUTO_GO_/AUTO_GO_.ino create mode 100755 Lesson 1 Make The Car Move/Make The Car Move.pdf create mode 100755 Lesson 1 Make The Car Move/Module specification document/9g steering gear.doc create mode 100755 Lesson 1 Make The Car Move/Module specification document/Arduino_Sensor_Shield_V5.doc create mode 100755 Lesson 1 Make The Car Move/Module specification document/HC-06.pdf create mode 100755 Lesson 1 Make The Car Move/Module specification document/Infrared remote controller.doc create mode 100755 Lesson 1 Make The Car Move/Module specification document/L298N.doc create mode 100755 Lesson 1 Make The Car Move/Module specification document/UNO.docx create mode 100755 Lesson 1 Make The Car Move/Module specification document/ultrasonic ranging modules_HC-SR04.doc create mode 100644 Lesson 1 Make The Car Move/forward_back/forward_back.ino create mode 100755 Lesson 1 Make The Car Move/left_wheel_rotation/left_wheel_rotation.ino create mode 100755 Lesson 1 Make The Car Move/right_wheel_rotation/right_wheel_rotation.ino (limited to 'Lesson 1 Make The Car Move') diff --git a/Lesson 1 Make The Car Move/AUTO_GO_/AUTO_GO_.ino b/Lesson 1 Make The Car Move/AUTO_GO_/AUTO_GO_.ino new file mode 100755 index 0000000..bcf48f2 --- /dev/null +++ b/Lesson 1 Make The Car Move/AUTO_GO_/AUTO_GO_.ino @@ -0,0 +1,77 @@ +//www.elegoo.com +//2016.09.12 + +/*define logic control output pin*/ +int in1=9; +int in2=8; +int in3=7; +int in4=6; +/*define channel enable output pins*/ +int ENA=10; +int ENB=5; +/*define forward function*/ +void _mForward() +{ + digitalWrite(ENA,HIGH); + digitalWrite(ENB,HIGH); + digitalWrite(in1,LOW);//digital output + digitalWrite(in2,HIGH); + digitalWrite(in3,LOW); + digitalWrite(in4,HIGH); + Serial.println("Forward"); +} +/*define back function*/ +void _mBack() +{ + digitalWrite(ENA,HIGH); + digitalWrite(ENB,HIGH); + digitalWrite(in1,HIGH); + digitalWrite(in2,LOW); + digitalWrite(in3,HIGH); + digitalWrite(in4,LOW); + Serial.println("Back"); +} +/*define left function*/ +void _mleft() +{ + digitalWrite(ENA,HIGH); + digitalWrite(ENB,HIGH); + digitalWrite(in1,LOW); + digitalWrite(in2,HIGH); + digitalWrite(in3,HIGH); + digitalWrite(in4,LOW); + Serial.println("Left"); +} +/*define right function*/ +void _mright() +{ + digitalWrite(ENA,HIGH); + digitalWrite(ENB,HIGH); + digitalWrite(in1,HIGH); + digitalWrite(in2,LOW); + digitalWrite(in3,LOW); + digitalWrite(in4,HIGH); + Serial.println("Right"); +} +/*put your setup code here, to run once*/ +void setup() { + Serial.begin(9600); //Open the serial port and set the baud rate to 9600 +/*Set the defined pins to the output*/ + pinMode(in1,OUTPUT); + pinMode(in2,OUTPUT); + pinMode(in3,OUTPUT); + pinMode(in4,OUTPUT); + pinMode(ENA,OUTPUT); + pinMode(ENB,OUTPUT); +} +/*put your main code here, to run repeatedly*/ +void loop() { +_mForward(); +delay(1000); +_mBack(); +delay(1000); +_mleft(); +delay(1000); +_mright(); +delay(1000); +} diff --git a/Lesson 1 Make The Car Move/Make The Car Move.pdf b/Lesson 1 Make The Car Move/Make The Car Move.pdf new file mode 100755 index 0000000..78f6261 Binary files /dev/null and b/Lesson 1 Make The Car Move/Make The Car Move.pdf differ diff --git a/Lesson 1 Make The Car Move/Module specification document/9g steering gear.doc b/Lesson 1 Make The Car Move/Module specification document/9g steering gear.doc new file mode 100755 index 0000000..61f0ed0 Binary files /dev/null and b/Lesson 1 Make The Car Move/Module specification document/9g steering gear.doc differ diff --git a/Lesson 1 Make The Car Move/Module specification document/Arduino_Sensor_Shield_V5.doc b/Lesson 1 Make The Car Move/Module specification document/Arduino_Sensor_Shield_V5.doc new file mode 100755 index 0000000..c71064d Binary files /dev/null and b/Lesson 1 Make The Car Move/Module specification document/Arduino_Sensor_Shield_V5.doc differ diff --git a/Lesson 1 Make The Car Move/Module specification document/HC-06.pdf b/Lesson 1 Make The Car Move/Module specification document/HC-06.pdf new file mode 100755 index 0000000..d26b2bf Binary files /dev/null and b/Lesson 1 Make The Car Move/Module specification document/HC-06.pdf differ diff --git a/Lesson 1 Make The Car Move/Module specification document/Infrared remote controller.doc b/Lesson 1 Make The Car Move/Module specification document/Infrared remote controller.doc new file mode 100755 index 0000000..7b15663 Binary files /dev/null and b/Lesson 1 Make The Car Move/Module specification document/Infrared remote controller.doc differ diff --git a/Lesson 1 Make The Car Move/Module specification document/L298N.doc b/Lesson 1 Make The Car Move/Module specification document/L298N.doc new file mode 100755 index 0000000..80e962e Binary files /dev/null and b/Lesson 1 Make The Car Move/Module specification document/L298N.doc differ diff --git a/Lesson 1 Make The Car Move/Module specification document/UNO.docx b/Lesson 1 Make The Car Move/Module specification document/UNO.docx new file mode 100755 index 0000000..f88e57e Binary files /dev/null and b/Lesson 1 Make The Car Move/Module specification document/UNO.docx differ diff --git a/Lesson 1 Make The Car Move/Module specification document/ultrasonic ranging modules_HC-SR04.doc b/Lesson 1 Make The Car Move/Module specification document/ultrasonic ranging modules_HC-SR04.doc new file mode 100755 index 0000000..9b5de91 Binary files /dev/null and b/Lesson 1 Make The Car Move/Module specification document/ultrasonic ranging modules_HC-SR04.doc differ diff --git a/Lesson 1 Make The Car Move/forward_back/forward_back.ino b/Lesson 1 Make The Car Move/forward_back/forward_back.ino new file mode 100644 index 0000000..e0047cb --- /dev/null +++ b/Lesson 1 Make The Car Move/forward_back/forward_back.ino @@ -0,0 +1,59 @@ +//www.elegoo.com +//2016.09.12 + +int ENA = 10; +int IN1 = 9; +int IN2 = 8; + +int IN3 = 7; +int IN4 = 6; +int ENB = 5; + +int SPEED = 100; + +void setup() +{ + pinMode(IN1, OUTPUT); + pinMode(IN2, OUTPUT); + pinMode(IN3, OUTPUT); + pinMode(IN4, OUTPUT); + pinMode(ENA, OUTPUT); + pinMode(ENB, OUTPUT); + +} +void loop() +{ + int i; + digitalWrite(IN1, LOW); + digitalWrite(IN2, HIGH); // left wheel goes forward + digitalWrite(IN3, LOW); + digitalWrite(IN4, HIGH); // right wheel goes forward + for (i = 0; i < 256; i++) { + analogWrite(ENA, i); + analogWrite(ENB, i); + delay(50); + } + for (i = 255; i >= 0; i--) { + analogWrite(ENA, i); + analogWrite(ENB, i); + delay(50); + } + /* + digitalWrite(IN1, LOW); + digitalWrite(IN2, LOW); //left wheel holds still + digitalWrite(IN3, LOW); + digitalWrite(IN4, LOW); // right wheel holds still + delay(500); + digitalWrite(IN1, HIGH); + digitalWrite(IN2, LOW); //left wheel is back up + digitalWrite(IN3, HIGH); + digitalWrite(IN4, LOW); // right wheel is back up + delay(500); + digitalWrite(IN1, LOW); + digitalWrite(IN2, LOW); // left wheel holds still + digitalWrite(IN3, LOW); + digitalWrite(IN4, LOW); // right wheel holds still + delay(500); + */ +} + diff --git a/Lesson 1 Make The Car Move/left_wheel_rotation/left_wheel_rotation.ino b/Lesson 1 Make The Car Move/left_wheel_rotation/left_wheel_rotation.ino new file mode 100755 index 0000000..3a751c6 --- /dev/null +++ b/Lesson 1 Make The Car Move/left_wheel_rotation/left_wheel_rotation.ino @@ -0,0 +1,31 @@ +//www.elegoo.com +//2016.09.12 + +/*In3 connected to the 7 pin, + In4 connected to the 6 pin, ENB pin 5,*/ +int ENB=5; +int IN3=7; +int IN4=6; +void setup() +{ + pinMode(IN3,OUTPUT); + pinMode(IN4,OUTPUT); + pinMode(ENB,OUTPUT); + digitalWrite(ENB,HIGH); +} +void loop() +{ + digitalWrite(IN3,LOW); + digitalWrite(IN4,HIGH); //Left wheel forward + delay(500); + digitalWrite(IN3,LOW); + digitalWrite(IN4,LOW); //Left wheel stop + delay(500); + digitalWrite(IN3,HIGH); + digitalWrite(IN4,LOW); //Left wheel back + delay(500); + digitalWrite(IN3,LOW); + digitalWrite(IN4,LOW); //Left wheel stop + delay(500); +} + 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