aboutsummaryrefslogtreecommitdiff
path: root/Lesson 3 Infrared Remote Control Car/Infrared_remote_control_car
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 /Lesson 3 Infrared Remote Control Car/Infrared_remote_control_car
parentd80736ab6e8e3cad2f1a30c6eaba2d6883dbe967 (diff)
Move lessons to doc
Diffstat (limited to 'Lesson 3 Infrared Remote Control Car/Infrared_remote_control_car')
-rwxr-xr-xLesson 3 Infrared Remote Control Car/Infrared_remote_control_car/Infrared_remote_control_car.ino124
1 files changed, 0 insertions, 124 deletions
diff --git a/Lesson 3 Infrared Remote Control Car/Infrared_remote_control_car/Infrared_remote_control_car.ino b/Lesson 3 Infrared Remote Control Car/Infrared_remote_control_car/Infrared_remote_control_car.ino
deleted file mode 100755
index 6890302..0000000
--- a/Lesson 3 Infrared Remote Control Car/Infrared_remote_control_car/Infrared_remote_control_car.ino
+++ /dev/null
@@ -1,124 +0,0 @@
-//www.elegoo.com
-//2016.09.12
-
-#include <IRremote.h>
-int receiverpin = 12;
-int in1=9;
-int in2=8;
-int in3=7;
-int in4=6;
-int ENA=10;
-int ENB=5;
-int ABS=130;
-unsigned long RED;
-#define A 16736925
-
-#define B 16754775
-
-#define X 16712445
-
-#define C 16720605
-
-#define D 16761405
-
-
-IRrecv irrecv(receiverpin);
-decode_results results;
-
-void _mForward()
-{
- digitalWrite(ENA,HIGH);
- digitalWrite(ENB,HIGH);
- digitalWrite(in1,LOW);
- digitalWrite(in2,HIGH);
- digitalWrite(in3,LOW);
- digitalWrite(in4,HIGH);
- Serial.println("go forward!");
-}
-void _mBack()
-{
- digitalWrite(ENA,HIGH);
- digitalWrite(ENB,HIGH);
- digitalWrite(in1,HIGH);
- digitalWrite(in2,LOW);
- digitalWrite(in3,HIGH);
- digitalWrite(in4,LOW);
- Serial.println("go back!");
-}
-void _mleft()
-{
- analogWrite(ENA,ABS);
- analogWrite(ENB,ABS);
- digitalWrite(in1,LOW);
- digitalWrite(in2,HIGH);
- digitalWrite(in3,HIGH);
- digitalWrite(in4,LOW);
- Serial.println("go left!");
-}
-void _mright()
-{
- analogWrite(ENA,ABS);
- analogWrite(ENB,ABS);
- digitalWrite(in1,HIGH);
- digitalWrite(in2,LOW);
- digitalWrite(in3,LOW);
- digitalWrite(in4,HIGH);
- Serial.println("go right!");
-}
-void _mStop()
-{
- digitalWrite(ENA,LOW);
- digitalWrite(ENB,LOW);
- Serial.println("STOP!");
-}
-void setup() {
- // put your setup code here, to run once:
- pinMode(in1,OUTPUT);
- pinMode(in2,OUTPUT);
- pinMode(in3,OUTPUT);
- pinMode(in4,OUTPUT);
- pinMode(ENA,OUTPUT);
- pinMode(ENB,OUTPUT);
- pinMode(receiverpin,INPUT);
- Serial.begin(9600);
- _mStop();
- irrecv.enableIRIn();
-}
-
-void loop() {
- if (irrecv.decode(&results))
- {
-
- RED=results.value;
- Serial.println(RED);
- irrecv.resume();
- delay(150);
- if(RED==A)
- {
- _mForward();
- }
-
- else if(RED==B)
- {
- _mBack();
- }
-
- else if(RED==C)
- {
- _mleft();
- }
-
- else if(RED==D)
- {
- _mright();
- }
-
-
- else if(RED==X)
- {
- _mStop();
- }
-
-}
-}
-