Sahil
#include <Servo.h> // Pin definitions const int mq2Pin 2; // Digital pin for MQ-2 sensor const int buzzerPin = 3; // Digital pin for buzzer const int relayPin 4; // Digital pin for relay module const int servoPin 5; // Digital pin for servo motor Servo myservo; // Create servo object void setup() { pinMode (mq2Pin, INPUT); pinMode(buzzerPin, OUTPUT); pinMode(relayPin, OUTPUT); myservo.attach(servoPin); // Attaching the servo motor // Set initial states deactivateAlarm(); deactivateRelay(); myservo.write(8); // Start with servo at e degrees } void loop() { // Reading from MQ-2 sensor int gasValue digitalRead(mq2Pin); // If gas is detected if (gasValue == LOW) { activateAlarm(); activateRelay(); // Activate alarm // Activate relay module turnServoTo90(); // Turn on servo motor to 90 degrees } else { deactivateAlarm(); deactivateRelay(); resetServo(); } }void activateAlarm() { // Deactivate alarm //Deactivate relay module // Reset servo motor to a degrees digitalWrite(buzzerPin...