From cdfc8d48fb36ef815ac498441d18d32c1bc8df66 Mon Sep 17 00:00:00 2001 From: Kirtiraj Date: Sun, 22 Jan 2023 22:55:25 +0530 Subject: [PATCH 1/5] added_example_files_to_lib --- examples/MQ135Test/MQ1135Test.ino | 58 +++++++++++++++++++++++ examples/MQ135_DHTxx/MQ135_DHTxx.ino | 71 ++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 examples/MQ135Test/MQ1135Test.ino create mode 100644 examples/MQ135_DHTxx/MQ135_DHTxx.ino diff --git a/examples/MQ135Test/MQ1135Test.ino b/examples/MQ135Test/MQ1135Test.ino new file mode 100644 index 0000000..9981c50 --- /dev/null +++ b/examples/MQ135Test/MQ1135Test.ino @@ -0,0 +1,58 @@ +/*-data-type------size---------description---------------------- + boolean (8 bit) - [true/false] + byte (8 bit) - [0-255] unsigned number + char (8 bit) - [-128 to 127] signed number + unsigned char (8 bit) - [-128 to 127] signed number + word (16 bit) - [0-65535] unsigned number + unsigned int (16 bit) - [0-65535] unsigned number + int (16 bit) - [-32768 to 32767] signed number + unsigned long (32 bit) - [0-4,294,967,295] unsigned number usually for millis + long (32 bit) - [-2,147,483,648 to 2,147,483,647] signed number + float (32 bit) - [-3.4028235E38 to 3.4028235E38] signed number + uint8_t (8 bit) - [0-255] unsigned number + int8_t (8 bit) - [-127 - 127] signed number + uint16_t (16 bit) - [0-65,535] unsigned number + int16_t (16 bit) - [-32,768 - 32,767] signed number + uint32_t (32 bit) - [0-4,294,967,295] unsigned number + int32_t (32 bit) - [-2,147,483,648 - 2,147,483,647] signed number + uint64_t (64 bit) - [0-18,446,744,073,709,551,615] unsigned number + int64_t (64 bit) - [−9,223,372,036,854,775,808 - 9,223,372,036,854,775,807] signed number + -------------------------------------------------------------- + camelCase - anything that changes + snake_case - variable's that are exclusive in a function + Snake_Case - CLASS/struct exclusave varables/functions + iNVERTEDcAMELcASE - outside code that is being accessed [database] + SNake_CAse - duplicate varables inside the case function [frequently used in library names] + ALL_CAPS - const varable names or defines + ------------- by jediRick & RefreshMyMind -------------------- +*/ + +#include +#include // added the library + +#define mq135read A0 // Initialization of the pin A0 + +MQ135 mq135(mq135read); // calling calss type + +float temperature = 24; // write your room Temperature +float humidity = 50; // pre define values Humidity + +void setup() +{ + Serial.begin(9600); // Setting baud rate +} + +void loop() +{ + float rzero = mq135.getRZero(); + float correctedRZero = mq135.getCorrectedRZero(temperature, humidity); + float resistance = mq135.getResistance(); + float ppm = mq135.getPPM(); + float correctedPPM = mq135.getCorrectedPPM(temperature, humidity); + + Serial.print("PPM: "); + Serial.print(correctedPPM); // printing the current PPM values it will take few min to settle. + Serial.println("ppm"); + + delay(100); +} \ No newline at end of file diff --git a/examples/MQ135_DHTxx/MQ135_DHTxx.ino b/examples/MQ135_DHTxx/MQ135_DHTxx.ino new file mode 100644 index 0000000..79785ee --- /dev/null +++ b/examples/MQ135_DHTxx/MQ135_DHTxx.ino @@ -0,0 +1,71 @@ +/*-data-type------size---------description---------------------- + boolean (8 bit) - [true/false] + byte (8 bit) - [0-255] unsigned number + char (8 bit) - [-128 to 127] signed number + unsigned char (8 bit) - [-128 to 127] signed number + word (16 bit) - [0-65535] unsigned number + unsigned int (16 bit) - [0-65535] unsigned number + int (16 bit) - [-32768 to 32767] signed number + unsigned long (32 bit) - [0-4,294,967,295] unsigned number usually for millis + long (32 bit) - [-2,147,483,648 to 2,147,483,647] signed number + float (32 bit) - [-3.4028235E38 to 3.4028235E38] signed number + uint8_t (8 bit) - [0-255] unsigned number + int8_t (8 bit) - [-127 - 127] signed number + uint16_t (16 bit) - [0-65,535] unsigned number + int16_t (16 bit) - [-32,768 - 32,767] signed number + uint32_t (32 bit) - [0-4,294,967,295] unsigned number + int32_t (32 bit) - [-2,147,483,648 - 2,147,483,647] signed number + uint64_t (64 bit) - [0-18,446,744,073,709,551,615] unsigned number + int64_t (64 bit) - [−9,223,372,036,854,775,808 - 9,223,372,036,854,775,807] signed number + -------------------------------------------------------------- + camelCase - anything that changes + snake_case - variable's that are exclusive in a function + Snake_Case - CLASS/struct exclusave varables/functions + iNVERTEDcAMELcASE - outside code that is being accessed [database] + SNake_CAse - duplicate varables inside the case function [frequently used in library names] + ALL_CAPS - const varable names or defines + ------------- by jediRick & RefreshMyMind -------------------- +*/ + +#include +#include +#include "DHT.h" // Lib used https://github.com/adafruit/DHT-sensor-library.git + #include +#define mq135read A0 // Initialization of the pin A0 +#define dhtpin 2 + +// Uncomment whatever module you're using! +#define DHTTYPE DHT11 // DHT 11 +// #define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321 +// #define DHTTYPE DHT21 // DHT 21 (AM2301) + +DHT dht(dhtpin, DHTTYPE); // Initialize DHT sensor. +MQ135 mq135(mq135read); // Initialize MQ135 sensor. + +void setup() +{ + Serial.begin(9600); // Setting baud rate +} + +void loop() +{ + + float humidity = dht.readHumidity(); + float temperature = dht.readTemperature(); + float rzero = mq135.getRZero(); + float correctedRZero = mq135.getCorrectedRZero(temperature, humidity); // Passing the t and h values. + float resistance = mq135.getResistance(); + float ppm = mq135.getPPM(); + float correctedPPM = mq135.getCorrectedPPM(temperature, humidity); // Passing the t and h values. + + Serial.print("Temperature: "); + Serial.println(temperature); // printing temperature data from dhtxx. + Serial.print("Humidity: "); + Serial.println(humidity); // printing humidity data from dhtxx. + + Serial.print("PPM: "); + Serial.print(correctedPPM); // printing the current PPM values it will take few min to settle. + Serial.println("ppm"); + + delay(1000); // Delay of 1Sec. +} \ No newline at end of file From b52bd377dcba6c19a8d02dd0e8d034e4d66268cd Mon Sep 17 00:00:00 2001 From: Kirtiraj Date: Sun, 22 Jan 2023 22:56:13 +0530 Subject: [PATCH 2/5] added_keywords_file_for_arduionide --- keywords.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 keywords.txt diff --git a/keywords.txt b/keywords.txt new file mode 100644 index 0000000..3a5ffce --- /dev/null +++ b/keywords.txt @@ -0,0 +1,22 @@ +#################################### +# Syntax Coloring Map For MQ135 Sensor +#################################### + +#################### +# Datatypes (KEYWORD1) +#################### + +MQ135 KEYWORD1 + + +###################### +# Functions (KEYWORD2) +###################### + +getCorrectionFactor KEYWORD2 +getResistance KEYWORD2 +getCorrectedResistance KEYWORD2 +getPPM KEYWORD2 +getCorrectedPPM KEYWORD2 +getRZero KEYWORD2 +getCorrectedRZero KEYWORD2 \ No newline at end of file From 2d3fe867c10e54e29fac759f36c93c3bfc747eb8 Mon Sep 17 00:00:00 2001 From: Kirtiraj Date: Sun, 22 Jan 2023 23:02:00 +0530 Subject: [PATCH 3/5] added_properties_file --- library.properties | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 library.properties diff --git a/library.properties b/library.properties new file mode 100644 index 0000000..cf8303d --- /dev/null +++ b/library.properties @@ -0,0 +1,10 @@ +name=MQ135 Sensor +version=1.0 +author= +maintainer= +sentence=Arduino library for MQ135 Sensor +paragraph=Arduino library for MQ135 Sensor +category=Sensors +url=https://github.com/RefreshMyMind-I/MQ135.git +architectures=* +depends= \ No newline at end of file From 68a66b83757b8e8a38cbf951879bfc115111e385 Mon Sep 17 00:00:00 2001 From: Kirtiraj Date: Sun, 22 Jan 2023 23:07:27 +0530 Subject: [PATCH 4/5] fixed_name_error --- examples/MQ135Test/MQ135Test.ino | 58 ++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 examples/MQ135Test/MQ135Test.ino diff --git a/examples/MQ135Test/MQ135Test.ino b/examples/MQ135Test/MQ135Test.ino new file mode 100644 index 0000000..9981c50 --- /dev/null +++ b/examples/MQ135Test/MQ135Test.ino @@ -0,0 +1,58 @@ +/*-data-type------size---------description---------------------- + boolean (8 bit) - [true/false] + byte (8 bit) - [0-255] unsigned number + char (8 bit) - [-128 to 127] signed number + unsigned char (8 bit) - [-128 to 127] signed number + word (16 bit) - [0-65535] unsigned number + unsigned int (16 bit) - [0-65535] unsigned number + int (16 bit) - [-32768 to 32767] signed number + unsigned long (32 bit) - [0-4,294,967,295] unsigned number usually for millis + long (32 bit) - [-2,147,483,648 to 2,147,483,647] signed number + float (32 bit) - [-3.4028235E38 to 3.4028235E38] signed number + uint8_t (8 bit) - [0-255] unsigned number + int8_t (8 bit) - [-127 - 127] signed number + uint16_t (16 bit) - [0-65,535] unsigned number + int16_t (16 bit) - [-32,768 - 32,767] signed number + uint32_t (32 bit) - [0-4,294,967,295] unsigned number + int32_t (32 bit) - [-2,147,483,648 - 2,147,483,647] signed number + uint64_t (64 bit) - [0-18,446,744,073,709,551,615] unsigned number + int64_t (64 bit) - [−9,223,372,036,854,775,808 - 9,223,372,036,854,775,807] signed number + -------------------------------------------------------------- + camelCase - anything that changes + snake_case - variable's that are exclusive in a function + Snake_Case - CLASS/struct exclusave varables/functions + iNVERTEDcAMELcASE - outside code that is being accessed [database] + SNake_CAse - duplicate varables inside the case function [frequently used in library names] + ALL_CAPS - const varable names or defines + ------------- by jediRick & RefreshMyMind -------------------- +*/ + +#include +#include // added the library + +#define mq135read A0 // Initialization of the pin A0 + +MQ135 mq135(mq135read); // calling calss type + +float temperature = 24; // write your room Temperature +float humidity = 50; // pre define values Humidity + +void setup() +{ + Serial.begin(9600); // Setting baud rate +} + +void loop() +{ + float rzero = mq135.getRZero(); + float correctedRZero = mq135.getCorrectedRZero(temperature, humidity); + float resistance = mq135.getResistance(); + float ppm = mq135.getPPM(); + float correctedPPM = mq135.getCorrectedPPM(temperature, humidity); + + Serial.print("PPM: "); + Serial.print(correctedPPM); // printing the current PPM values it will take few min to settle. + Serial.println("ppm"); + + delay(100); +} \ No newline at end of file From 159143978ef6a7e52fd6029abdfa91a80329288f Mon Sep 17 00:00:00 2001 From: Kirtiraj Date: Sun, 22 Jan 2023 23:09:38 +0530 Subject: [PATCH 5/5] deps_removed --- library.properties | 1 - 1 file changed, 1 deletion(-) diff --git a/library.properties b/library.properties index cf8303d..ef9f614 100644 --- a/library.properties +++ b/library.properties @@ -7,4 +7,3 @@ paragraph=Arduino library for MQ135 Sensor category=Sensors url=https://github.com/RefreshMyMind-I/MQ135.git architectures=* -depends= \ No newline at end of file