mq135

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
pablolopez89
Date:
Sun May 12 02:00:13 2019 +0000
Parent:
0:59011d343342
Commit message:
mq135

Changed in this revision

MQ135.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 59011d343342 -r 8944058d8e95 MQ135.cpp
--- a/MQ135.cpp	Fri Jun 16 15:01:55 2017 +0000
+++ b/MQ135.cpp	Sun May 12 02:00:13 2019 +0000
@@ -1,18 +1,20 @@
 #include "MQ135.h"
 #include "mbed.h"
 
-MQ135::MQ135(PinName pin) : _pin(pin) {
+MQ135::MQ135(PinName pin) : _pin(pin) 
+{
     _pin = A0;
-   
 }
-void MQ135::initialize(){
+void MQ135::initialize()
+{
     mqR = 22000;
     rO = 41763;
     a = 116.6020682;
     b = -2.769034857;
     adc_limit = 65535;
     }
-float MQ135::getPPM() {
+float MQ135::getPPM() 
+{
      Serial pc(USBTX,USBRX);
     float adcRaw=_pin.read_u16();
     pc.printf("adc: %f\n\r", adcRaw);
@@ -25,32 +27,37 @@
     pc.printf("ppm: %f\n\r", ppm);
     return ppm;
 }
-int MQ135::air_quality(){
+int MQ135::air_quality()
+{
      Serial pc(USBTX,USBRX);
      float adcRaw=_pin.read_u16()/64;
     //Aire limpio
-    if(adcRaw <= 55){
+    if(adcRaw <= 55)
+        {
         pc.printf("Aire limpio \n\r");
         pc.printf("\n\r");
         return 0;
         }
         
     //Dioxido de carbono bajo (Respiracion humana)
-    if( adcRaw >= 56 && adcRaw <= 73){
+    if( adcRaw >= 56 && adcRaw <= 73)
+        {
         pc.printf("Aire con un poco de CO2 \n\r");
         pc.printf("\n\r");
         return 1;
         }
         
     //Dioxido de carbono
-    if( adcRaw >= 74 && adcRaw <= 350){
+    if( adcRaw >= 74 && adcRaw <= 350)
+        {
         pc.printf("Dioxido de carbono CO2 \n\r");
         pc.printf("\n\r");
         return 2;
         }
         
     //Gas propano y butano
-    if(adcRaw >= 400){
+    if(adcRaw >= 400)
+        {
         pc.printf("Propano butano \n\r");
         pc.printf("\n\r");
         return 3;
diff -r 59011d343342 -r 8944058d8e95 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun May 12 02:00:13 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file