aboutsummaryrefslogtreecommitdiff
path: root/doc/Lesson 1 Make The Car Move
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-08-26 20:33:02 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-08-26 20:33:02 +0200
commitba216919262d7f888bfb99debf81babe1ce88e0e (patch)
tree16c19610a7a3a77c97b99a63f6ba85d11ebde4ec /doc/Lesson 1 Make The Car Move
parentd80736ab6e8e3cad2f1a30c6eaba2d6883dbe967 (diff)
Move lessons to doc
Diffstat (limited to 'doc/Lesson 1 Make The Car Move')
-rwxr-xr-xdoc/Lesson 1 Make The Car Move/AUTO_GO_/AUTO_GO_.ino77
-rwxr-xr-xdoc/Lesson 1 Make The Car Move/Make The Car Move.pdfbin0 -> 1806123 bytes
-rwxr-xr-xdoc/Lesson 1 Make The Car Move/Module specification document/9g steering gear.docbin0 -> 85315 bytes
-rwxr-xr-xdoc/Lesson 1 Make The Car Move/Module specification document/Arduino_Sensor_Shield_V5.docbin0 -> 1608704 bytes
-rwxr-xr-xdoc/Lesson 1 Make The Car Move/Module specification document/HC-06.pdfbin0 -> 639451 bytes
-rwxr-xr-xdoc/Lesson 1 Make The Car Move/Module specification document/Infrared remote controller.docbin0 -> 609792 bytes
-rwxr-xr-xdoc/Lesson 1 Make The Car Move/Module specification document/L298N.docbin0 -> 1141760 bytes
-rwxr-xr-xdoc/Lesson 1 Make The Car Move/Module specification document/UNO.docxbin0 -> 630837 bytes
-rwxr-xr-xdoc/Lesson 1 Make The Car Move/Module specification document/ultrasonic ranging modules_HC-SR04.docbin0 -> 1007616 bytes
-rw-r--r--doc/Lesson 1 Make The Car Move/forward_back/forward_back.ino59
-rwxr-xr-xdoc/Lesson 1 Make The Car Move/left_wheel_rotation/left_wheel_rotation.ino31
-rwxr-xr-xdoc/Lesson 1 Make The Car Move/right_wheel_rotation/right_wheel_rotation.ino31
12 files changed, 198 insertions, 0 deletions
diff --git a/doc/Lesson 1 Make The Car Move/AUTO_GO_/AUTO_GO_.ino b/doc/Lesson 1 Make The Car Move/AUTO_GO_/AUTO_GO_.ino
new file mode 100755
index 0000000..bcf48f2
--- /dev/null
+++ b/doc/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/doc/Lesson 1 Make The Car Move/Make The Car Move.pdf b/doc/Lesson 1 Make The Car Move/Make The Car Move.pdf
new file mode 100755
index 0000000..78f6261
--- /dev/null
+++ b/doc/Lesson 1 Make The Car Move/Make The Car Move.pdf
Binary files differ
diff --git a/doc/Lesson 1 Make The Car Move/Module specification document/9g steering gear.doc b/doc/Lesson 1 Make The Car Move/Module specification document/9g steering gear.doc
new file mode 100755
index 0000000..61f0ed0
--- /dev/null
+++ b/doc/Lesson 1 Make The Car Move/Module specification document/9g steering gear.doc
Binary files differ
diff --git a/doc/Lesson 1 Make The Car Move/Module specification document/Arduino_Sensor_Shield_V5.doc b/doc/Lesson 1 Make The Car Move/Module specification document/Arduino_Sensor_Shield_V5.doc
new file mode 100755
index 0000000..c71064d
--- /dev/null
+++ b/doc/Lesson 1 Make The Car Move/Module specification document/Arduino_Sensor_Shield_V5.doc
Binary files differ
diff --git a/doc/Lesson 1 Make The Car Move/Module specification document/HC-06.pdf b/doc/Lesson 1 Make The Car Move/Module specification document/HC-06.pdf
new file mode 100755
index 0000000..d26b2bf
--- /dev/null
+++ b/doc/Lesson 1 Make The Car Move/Module specification document/HC-06.pdf
Binary files differ
diff --git a/doc/Lesson 1 Make The Car Move/Module specification document/Infrared remote controller.doc b/doc/Lesson 1 Make The Car Move/Module specification document/Infrared remote controller.doc
new file mode 100755
index 0000000..7b15663
--- /dev/null
+++ b/doc/Lesson 1 Make The Car Move/Module specification document/Infrared remote controller.doc
Binary files differ
diff --git a/doc/Lesson 1 Make The Car Move/Module specification document/L298N.doc b/doc/Lesson 1 Make The Car Move/Module specification document/L298N.doc
new file mode 100755
index 0000000..80e962e
--- /dev/null
+++ b/doc/Lesson 1 Make The Car Move/Module specification document/L298N.doc
Binary files differ
diff --git a/doc/Lesson 1 Make The Car Move/Module specification document/UNO.docx b/doc/Lesson 1 Make The Car Move/Module specification document/UNO.docx
new file mode 100755
index 0000000..f88e57e
--- /dev/null
+++ b/doc/Lesson 1 Make The Car Move/Module specification document/UNO.docx
Binary files differ
diff --git a/doc/Lesson 1 Make The Car Move/Module specification document/ultrasonic ranging modules_HC-SR04.doc b/doc/Lesson 1 Make The Car Move/Module specification document/ultrasonic ranging modules_HC-SR04.doc
new file mode 100755
index 0000000..9b5de91
--- /dev/null
+++ b/doc/Lesson 1 Make The Car Move/Module specification document/ultrasonic ranging modules_HC-SR04.doc
Binary files differ
diff --git a/doc/Lesson 1 Make The Car Move/forward_back/forward_back.ino b/doc/Lesson 1 Make The Car Move/forward_back/forward_back.ino
new file mode 100644
index 0000000..e0047cb
--- /dev/null
+++ b/doc/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/doc/Lesson 1 Make The Car Move/left_wheel_rotation/left_wheel_rotation.ino b/doc/Lesson 1 Make The Car Move/left_wheel_rotation/left_wheel_rotation.ino
new file mode 100755
index 0000000..3a751c6
--- /dev/null
+++ b/doc/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/doc/Lesson 1 Make The Car Move/right_wheel_rotation/right_wheel_rotation.ino b/doc/Lesson 1 Make The Car Move/right_wheel_rotation/right_wheel_rotation.ino
new file mode 100755
index 0000000..766573c
--- /dev/null
+++ b/doc/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);
+}
+