Finish line code

Hey guys I'm using a TEPT5700 as a break beam sensor.

Sensor circuit:

Blue wire == 5v, grey wire == PIN 2, purple wire == GND.

The code I have is for use with a PNP sensor but I'm using an NPN sensor. The sensor closes when light is detected from my laser and then closes my relay. But what I would like is for the sensor to close when the laser beam is broke.

How do I ajust the code accordingly for this situation.

I'm still learning to code and i work well with examples. Sorry again if I'm not coming across clearly with my explanation.

Thankyou kindly.

const int ledPin1 = 12;
const int ledPin2 = 13;
const int sensorPin1 = 2;
const int sensorPin2 = 3;
const int TIMEOUT = 3000; // milliseconds

// Setup runs once, at start
// Input and Output pins are set
void setup(){
   pinMode(sensorPin1, INPUT);
   pinMode(sensorPin2, INPUT);
   pinMode(ledPin1, OUTPUT);
   pinMode(ledPin2, OUTPUT);

// Called repeatedly
void loop() {
   // Get the Sensor status
   int status1 = digitalRead(sensorPin1);
   int status2 = digitalRead(sensorPin2);

   // Set the output LED to match the sensor
   digitalWrite(ledPin1, status1);
   digitalWrite(ledPin2, status2);

   if (status1 == HIGH || status2 == HIGH) {
      // A sensor was tripped, show the results until timeout
      delay(TIMEOUT); // Wait for timeout

Okay, time to ask whether you have provided all the information necessary to ask a question.

Thanks for using code tags.

Show us a good schematic & image of your circuit wiring.
Posting images:

Sorry about that. And thankyou for the link to explain how to upload a picture.

A schematic is needed for us to see what your are trying to do.

Please verify the input control of the relay modules have a common ground to the Arduino.

Looks like someone is reposting on the forum.

This is a very bad thing to do.

What do you read from the pin when the sensor is not blocked?
What do you read from the pin when the sensor is blocked?

It is easy to adjust the code when we know the answers to these questions.

Don’t see a signal return wire from relays GND to Arduino GND.