#include <MPU6050.h>               // Library for MPU6050 Accelerometer/Gyroscope
#include <MQ135.h>                 // Library for MQ135 Gas Sensor

// Define pin numbers
#define MQ135_PIN A0              // Pin for MQ135 gas sensor
#define MPU_SDA_PIN A4            // Pin for SDA (MPU6050 I2C communication)
#define MPU_SCL_PIN A5            // Pin for SCL (MPU6050 I2C communication)

// Sensor objects
MPU6050 mpu;  // Create an MPU6050 object
MQ135 gasSensor(MQ135_PIN);  // Create an MQ135 gas sensor object

void setup() {
  Wire.begin();  // Default I2C pins (A4 for SDA, A5 for SCL)
  mpu.initialize();  // Initialize the MPU6050 sensor
}

void loop() {
  // Read MPU6050 data (accelerometer and gyroscope)
  int16_t ax, ay, az;
  int16_t gx, gy, gz;
  mpu.getAcceleration(&ax, &ay, &az);
  mpu.getRotation(&gx, &gy, &gz);

  // Read gas concentration from MQ135
  float gasConcentration = gasSensor.getPPM();  // Correct function call for MQ135

  delay(500);  // Wait for 500ms before the next loop
}
