//including softwareSerial lib
#include <SoftwareSerial.h>
//bluetooth
SoftwareSerial bluetooth(10, 11);
void setup(){
//starting Serial
Serial.begin(9600);
//Starting bluetooth
bluetooth.begin(9600);
}
void loop(){
//defining int ppm for output value of mq135 sensor
int ppm = analogRead(A0);
//sending message to bluetooth
bluetooth.print(ppm);
bluetooth.print(";");
// printing it in Serial
Serial.print("Air Quality : ");
Serial.print(ppm);
//delaying the time
delay(10);
}
//connect mq135 sensor A0 to arduino A0
//connect mq135 sensor GND to arduino GND
//connect mq135 sensor VCC to arduino 5v
//connect H2105 sensor GND to to arduino GND
//connect H2105 sensor RX to to arduino TX
//connect H2105 sensor TX to to arduino RX
//connect H2105 sensor VCC to to arduino 5v
Comments
Please log in or sign up to comment.