Arduino Code and video for E18-D80NK Infrared Obstacle Avoidance Sensor
Arduino code for E18-D80NK Infrared Obstacle Avoidance Sensor
This is the Arduino code for E18-D80NK Infrared Obstacle Avoidance Sensor This code is to use E18-D80NK Infrared Sensor to detect obstacle and trigger an event like starting or stopping motor or servo or relay or anything else.
Purchase E18-D80NK hall sensor
-Amazon Canada-Amazon USA
-Amazon Europe (All)
Chapters of this video
- 00:00 Introduction
- 01:59 Wiring Explained
- 03:54 Code is explained
- 07:42 Demo of the module is shown
- 08:50 Setting the Sensitivity
E18-D80NK Infrared Sensor: Connected to Arduino and buzzer
Click on image to enlarge
E18-D80NK Infrared Sensor: Sensor
Click on image to enlarge
E18-D80NK Infrared Sensor: TX RX leses
Click on image to enlarge
E18-D80NK Infrared Sensor: Sensitivity screw
Click on image to enlarge
E18-D80NK Infrared Sensor: Wiring color
Click on image to enlarge
E18-D80NK Infrared Sensor: Wiring with resistor
Click on image to enlarge
E18-D80NK Infrared Sensor: Setting Sensitivity
Click on image to enlarge
E18-D80NK Infrared Sensor: Demonstration using Arduino
Click on image to enlarge
- Robojax Crash Course on Arduino: Learn Arduino in 30 Minutes (code and video)
- Learn Arduino step by step from beginner to Advanced (Coruse)
- Get Early Access to my videos via Patreon
/*
* This is the Arduino code for LE18-D80NK Infrared Obstacle Avoidance Sensor
This code is to use E18-D80NK Infrared Sensor to detect obstacle and trigger an
event like starting or stopping motor or servo or relay or anything else.
* *
// Writeen by Ahmad S. for Robojax.com on
// on Feb 22, 2018 at 20:50 om city of Ajax, Ontario, Canada
* Permission granted to share this code given that this
* note is kept with the code.
* Disclaimer: this code is "AS IS" and for educational purpose only.
*
* watch LE18-D80NK video for details https://youtu.be/MrYsmAwzfrM
* Code is available at http://robojax.com/learn/arduino
the Wiring:
Brown: 5V DC
Blue: GNG
Black: Signal, to PIN 2
*
*/
#define SENSOR 2 // define pint 2 for sensor
#define ACTION 9 // define pin 9 as for ACTION
/*
* Permission granted to share this code given that this
* note is kept with the code.
* Disclaimer: this code is "AS IS" and for educational purpose only.
*
*/
void setup() {
// E18-D80NK Obstacle Sensor Code by Robojax.com 2018022
Serial.begin(9600);// setup Serial Monitor to display information
pinMode(SENSOR, INPUT_PULLUP);// define pin as Input sensor
pinMode(ACTION, OUTPUT);// define pin as OUTPUT for ACTION
}
void loop() {
// E18-D80NK Obstacle Sensor Code by Robojax.com 2018022
int L =digitalRead(SENSOR);// read the sensor
if(L == 0){
Serial.println(" Obstacle detected");
digitalWrite(ACTION,HIGH);// send singal
}else{
Serial.println(" === All clear");
digitalWrite(ACTION,LOW);// turn the relay OFF
}
delay(500);
// E18-D80NK Obstacle Sensor Code by Robojax.com 2018022
}