mirror of
				https://github.com/miguel5612/MQSensorsLib.git
				synced 2025-10-30 14:44:04 +03:00 
			
		
		
		
	MQ lectures
This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								.vscode/ipch/e30e48ba9e7cbd6a/mmap_address.bin
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.vscode/ipch/e30e48ba9e7cbd6a/mmap_address.bin
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -72,15 +72,18 @@ void MQUnifiedsensor::inicializar() | |||||||
| } | } | ||||||
| int MQUnifiedsensor::readSensor(String nameLectureRequeired, bool print) | int MQUnifiedsensor::readSensor(String nameLectureRequeired, bool print) | ||||||
| { | { | ||||||
|   setSensorCharacteristics(nameLectureRequeired); |   setSensorCharacteristics(nameLectureRequeired, print); | ||||||
|   _PPM =readPPM(_m, _b); |   _PPM =readPPM(_m, _b); | ||||||
|   if(print) |   if(print) | ||||||
|   { |   { | ||||||
|     Serial.print("Medicion: "); |     String nameLecture = getnameLecture(); | ||||||
|  |    | ||||||
|  |     Serial.print("Medicion"); | ||||||
|  |     Serial.print("(" + nameLecture + "): "); | ||||||
|     Serial.println(_PPM); |     Serial.println(_PPM); | ||||||
|     Serial.print("Slope: "); |     Serial.print("Slope: "); | ||||||
|     Serial.print(String(_m)); |     Serial.print(String(_m)); | ||||||
|     Serial.print("B point: "); |     Serial.print(", B point: "); | ||||||
|     Serial.println(String(_b)); |     Serial.println(String(_b)); | ||||||
|   } |   } | ||||||
|   return _PPM; |   return _PPM; | ||||||
| @@ -89,8 +92,9 @@ String MQUnifiedsensor::getnameLecture() | |||||||
| { | { | ||||||
|   return nameLecture[_lecturePosInArray]; |   return nameLecture[_lecturePosInArray]; | ||||||
| } | } | ||||||
| void MQUnifiedsensor::setSensorCharacteristics(String nameLectureRequeired) | void MQUnifiedsensor::setSensorCharacteristics(String nameLectureRequeired, bool print) | ||||||
| { | { | ||||||
|  |   //Defaults index | ||||||
|   if(nameLectureRequeired == "") |   if(nameLectureRequeired == "") | ||||||
|   { |   { | ||||||
|     if(_type == 2) |     if(_type == 2) | ||||||
| @@ -144,6 +148,7 @@ void MQUnifiedsensor::setSensorCharacteristics(String nameLectureRequeired) | |||||||
|   } |   } | ||||||
|   else  |   else  | ||||||
|   { |   { | ||||||
|  |     //Dinamic index search | ||||||
|     for (int i=0; i<lecturesAvailable; i++) { |     for (int i=0; i<lecturesAvailable; i++) { | ||||||
|         if (nameLectureRequeired = nameLecture[i]) {    //modified here |         if (nameLectureRequeired = nameLecture[i]) {    //modified here | ||||||
|           _lecturePosInArray = i; |           _lecturePosInArray = i; | ||||||
| @@ -151,7 +156,18 @@ void MQUnifiedsensor::setSensorCharacteristics(String nameLectureRequeired) | |||||||
|         } |         } | ||||||
|       } |       } | ||||||
|   } |   } | ||||||
|  |   //Serial debugging | ||||||
|  |   if(print) | ||||||
|  |   { | ||||||
|  |     String nameLecture = getnameLecture(); | ||||||
|    |    | ||||||
|  |     Serial.print("index in nameLectures: "); | ||||||
|  |     Serial.println(_lecturePosInArray); | ||||||
|  |     Serial.print("Slope index: "); | ||||||
|  |     Serial.println(indexSlopeLectures[_lecturePosInArray]); | ||||||
|  |     Serial.print("B point index: "); | ||||||
|  |     Serial.println(indexBPointLectures[_lecturePosInArray]); | ||||||
|  |   } | ||||||
|   _m = _MQ[indexSlopeLectures[_lecturePosInArray]]; |   _m = _MQ[indexSlopeLectures[_lecturePosInArray]]; | ||||||
|   _b = _MQ[indexBPointLectures[_lecturePosInArray]]; |   _b = _MQ[indexBPointLectures[_lecturePosInArray]]; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ class MQUnifiedsensor | |||||||
|     MQUnifiedsensor(int pin, int type); |     MQUnifiedsensor(int pin, int type); | ||||||
|     void inicializar(); |     void inicializar(); | ||||||
|     void setR0(double R0); |     void setR0(double R0); | ||||||
|     void setSensorCharacteristics(String nameLectureReqeuired); |     void setSensorCharacteristics(String nameLectureReqeuired, bool print); | ||||||
|      |      | ||||||
|     int readSensor(String nameLectureRequeired = "", bool print = false); |     int readSensor(String nameLectureRequeired = "", bool print = false); | ||||||
|     int readPPM(int m, int b); |     int readPPM(int m, int b); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 miguel5612
					miguel5612