lCODE:-
// Define the pins
const int irSensorPin = 2; // IR sensor output connected to digital pin 2
const int laserPin = 3; // Laser module connected to digital pin 3
void setup() {
// Initialize the pins
pinMode(irSensorPin, INPUT);
pinMode(laserPin, OUTPUT);
// Set the initial state of the laser module
digitalWrite(laserPin, LOW);
}
void loop() {
// Check if the IR sensor detects a hand wave
if (digitalRead(irSensorPin) == HIGH) {
digitalWrite(laserPin, HIGH); // turn on the laser
} else {
digitalWrite(laserPin, LOW); // turn off the laser
}
}