Categories

Arduino and the KTIR0711S reflective sensor

The Arduino and sensor diffusion sensor KTIR0711S

 

Quick start guide presented how to connect the Arduino and sensor diffusion sensor.

 

In this example we used the following elements:

 

Connect the sensor with Arduino:

The sensor using the Arduino you should connect the layout as follows:

 

SensorPin Arduino
GNDGND
OUTA1
VCC5 V

 

 

The connection scheme of sensor with the Arduino Uno.

 

Program for Arduino

In the example, we used the following code:

 

int sensor = A1; //analog pin A1 is connected to the signal from the sensor 

void setup(){ 
 Serial.begin(9600); //initialize serial monitor 
 Serial.println("Test sensor odbiciowego"); 
} 

void loop(){ 
 int layer count = analogRead(sensor); //read the value from the sensor 
 Serial.println(odl); //display it on the monitor 

 delay(200); //delay between consecutive readings 
} 

 

The values are read in the monitor a consistent decrease with approaching the obstacle. The effects of the program can be seen in the following screenshot:

 

A screenshot of the serial monitor.