#define MQ2_NODE_ADDRESS 2 // I2C address of the MQ2 node module #include const int MQ2_PIN = 4; // Analog pin connected to MQ2 sensor int gasValue = 0; void setup() { delay(20000); // allow the MQ2 to warm up Wire.begin(MQ2_NODE_ADDRESS); // Set the I2C slave address (0x43 for MQ2 gas sensor) Wire.onRequest(requestEvent); // Register the request event handler } void loop() { // Read gas sensor data gasValue = analogRead(MQ2_PIN); delay(2000); } void requestEvent() { Wire.write(gasValue); }