// Define the pin numbers
const int transmitterPin = 2; // Connected to S pin of transmitter KY-008
const int receiverPin = 3;    // Connected to S pin of receiver KY-008
const int buzzerPin = 5;      // Connected to the positive terminal of the buzzer
const int ledPin = 4;


void setup() {
  Serial.begin(9600);
  pinMode(transmitterPin, OUTPUT); // Set transmitterPin as output
  pinMode(receiverPin, INPUT);     // Set receiverPin as input
  pinMode(buzzerPin, OUTPUT);   // Set buzzerPin as output
  pinMode(ledPin, OUTPUT);  

    // Activate the transmitter to emit laser light
  digitalWrite(transmitterPin, HIGH); 
}


void loop() {
  
  // Read the state of the receiver
  bool value = digitalRead(receiverPin);

  // Check if laser light is not received (LOW state)
  if (value == 0) {
    // Activate the buzzer
    digitalWrite(buzzerPin, LOW);
    digitalWrite(ledPin, LOW);
   // Turn off the buzzer
   
  }else {
   digitalWrite(buzzerPin,HIGH); 
    digitalWrite(ledPin, HIGH); 

  }
  
}
$abcdeabcde151015202530fghijfghij