Hello everybody!
I really hope that here I will find understanding and caring people.
I have a task on which I have been working for the second week, but the results of the work do not make me very happy.
The task is as follows: assemble an Arduino based label applicator using IR obstacle sensor YL-63 and Photointerrupter TCST2103.
an obstacle sensor detects the presence of an object on the conveyor belt and sends a signal to the stepper motor to unwind the tape with a label (label length 130 - 160 mm)
on a signal from the photo interrupter, the stepping motor should stop rotating until the IR obstacle sensor is triggered again. This is necessary for the operation of the printer that prints the marker.
The sketch I wrote is probably not entirely correct, since I cannot run a full cycle of the applicator.
I was able to write and debug separate code for each component of the schema to work.
Attempts to put it together into a coherent structure end in failure.
Here is my code:
#include <Stepper.h>
const int sensor_one = A1; // IR obstacle sensor YL-63;
const int sensor_two = A2; // Photointerrupter TCST2103;
const int stepsPerRevolution = 12000; // Number of stages of the motor shaft;
int driverPUL = 8; // PUL- pin;
int driverDIR = 9; // DIR- pin;
int check_1 = sensor_one; // Assign ""check_1"" a value to a variable ""sensor_one"";
int check_2 = sensor_two; // Assign ""check_2"" a value to a variable ""sensor_two""
Stepper myStepper(stepsPerRevolution, 1, 2); // initialize the Stepper library on pins 1, 2;
void setup()
{
Serial.begin(9600); // Initialize the serial port:
pinMode (driverDIR, OUTPUT);
pinMode (driverPUL, OUTPUT);
myStepper.setSpeed(95); // set the speed to 95 rpm:
pinMode(sensor_one, INPUT);
pinMode(sensor_two, INPUT);
}
void loop()
{
if (check_1 = HIGH)
{
do
{
Stepp_Motor();
}
while ((check_2 = LOW));
}
}
void Stepp_Motor() // Function for stepper motor;
{
myStepper.step(stepsPerRevolution); // Motor run;
delay (500); // Delay 2sec between each push;
}
Thank you!

Well done running one sensor at time and knowing a bit of that coding.
If You would post the code using code tags readers would be even more happy. (The leftmost symbol above the reply window, </>
What does actually happend when You run that code? What does the fault look like?
If You are a commercially working guy You are a little bit outside the aim of this forum. Helpers work for free, doesn't get a cent, a penny, so "the industri" is not our first target.
What does the code actually do? How is that different from what you want?
Pin 1 is the hardware serial TX pin on many Arduinos. Which Arduino are you using?
Please use the IDE autoformat tool before posting code. Post code in code tags. Read the forum guidelines.
Thanks for the comment, next time I will be more attentive!
I fixed the code by placing tags. 
About Arduino : I am using the Nano version.
I have not tested this code on a mock, I need to do it today.
and this is the third version of the code.
In the previous version, I was able to create a relationship between the IR obstacle sensor and the engines.
if (IR obstacle = 1) {engine running}
if (IR obstacle = 0) {motor does not work}
I understand perfectly well that such forums are not created for commercial projects.
I just hope to take a fresh look at my project with the help and comments of more experienced colleagues.
Hi,
Have you moved the input from pin1?
Pin0 and Pin1 are the Tx/Rx pins used when programming the Nano.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Thanks.. Tom... 
Hi, Tom!
Thank you for admonition!
This error occurred while writing a new version.
In the circuit, the motor is connected to pins 8 and 9.
I edited the code in the first post 
Your check_1 and check_2 variables don't do what you are expecting. They are set to 15 and 16 respectively (On an Uno) and never change. You need to use digitalRead to get the state of a pin.
wildbill:
Your check_1 and check_2 variables don't do what you are expecting. They are set to 15 and 16 respectively (On an Uno) and never change. You need to use digitalRead to get the state of a pin.
Hi, bill!
then this function should look like this?
int check_1 = digitalRead(A1);
int check_2 = digitalRead(A2);
Kind of. You created sensor_one as a name for A1, so why not use it. Also, you need the digitalReads to happen in the loops that rely on the values of the check variables changing.
I had to rewrite the code in the "void loop" part
the first sketch refuses to work.
Now the code looks like this.
#include <Stepper.h>
const int sensor_one = A1; // IR obstacle sensor YL-63;
const int sensor_two = A2; // Photointerrupter TCST2103;
const int stepsPerRevolution = 12000; // Number of stages of the motor shaft;
int driverPUL = 8; // PUL- pin;
int driverDIR = 9; // DIR- pin;
int check_1 = digitalRead(sensor_one); // Assign ""check_1"" a value to a variable ""sensor_one"";
int check_2 = digitalRead(sensor_two); // Assign ""check_2"" a value to a variable ""sensor_two""
Stepper myStepper(stepsPerRevolution, 1, 2); // initialize the Stepper library on pins 1, 2;
void setup()
{
Serial.begin(9600); // Initialize the serial port:
pinMode (driverDIR, OUTPUT);
pinMode (driverPUL, OUTPUT);
myStepper.setSpeed(95); // set the speed to 95 rpm:
pinMode(sensor_one, INPUT);
pinMode(sensor_two, INPUT);
}
void loop()
{
Stepp_Motor();
Motor_STOP();
}
void Stepp_Motor() // Function for stepper motor;
{
if (check_1 == HIGH && check_2 == LOW)
{
myStepper.step(stepsPerRevolution); // Motor run;
delay (500); // Delay 2sec between each push;
}
}
void Motor_STOP() // Function for stop motor;
{
if (check_1 == LOW && check_2 == HIGH);
{
myStepper.step(0); // Motor run == 0;
}
}
Does the code do what you want?
Next, get rid of delay().
Non-blocking timing tutorials:
Several things at a time.
Beginner's guide to millis().
Blink without delay().
You have a fundamental misunderstanding about how assignment works and it's going to stop your code from doing anything useful until you figure it out.
Case in point:
int check_1 = digitalRead(sensor_one); // Assign ""check_1"" a value to a variable ""sensor_one"";
What that does is read a pin and store the result in a global variable called check_1. Once, when the program starts. It will never change again.
However, you use check_1 as if it will magically change when your IR sensor sees something. It won't. You need to explicitly call digitalRead again if you want to know what that pin is doing after the first time you called it.
wildbill:
You have a fundamental misunderstanding about how assignment works and it's going to stop your code from doing anything useful until you figure it out.
Case in point:
int check_1 = digitalRead(sensor_one); // Assign ""check_1"" a value to a variable ""sensor_one"";
What that does is read a pin and store the result in a global variable called check_1. Once, when the program starts. It will never change again.
However, you use check_1 as if it will magically change when your IR sensor sees something. It won't. You need to explicitly call digitalRead again if you want to know what that pin is doing after the first time you called it.
I understood you correctly.
Need to call digitalRead in every function to check sensor status?
In every function using that variable.
wildbill:
That's it.
in this case I can get rid of the global variable and pass the values to the local
void Stepp_Motor() // Function for stepper motor;
{
int check_1 = digitalRead(sensor_one);
int check_2 = digitalRead(sensor_two);
if (check_1 == HIGH && check_2 == LOW)
{
myStepper.step(stepsPerRevolution); // Motor run;
delay (500); // Delay 2sec between each push;
}
}
[/code]e] int check_1 = digitalRead(sensor_one);
int check_2 = digitalRead(sensor_two);
if (check_1 == HIGH && check_2 == LOW)
[/code]
can be written
if (digitalRead(sensor_one) && !digitalRead(sensor_two))
Is this code notation format acceptable?