Library for MQ7 gas sensor
Revision 1:beae29b45281, committed 2021-03-19
- Comitter:
- pkunnals
- Date:
- Fri Mar 19 18:57:26 2021 +0000
- Parent:
- 0:398854b7b855
- Commit message:
- Modified
Changed in this revision
| MQ7.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/MQ7.cpp Sun Jul 02 11:37:29 2017 +0000
+++ b/MQ7.cpp Fri Mar 19 18:57:26 2021 +0000
@@ -7,13 +7,13 @@
}
int MQ7::get_CO_value(){
float a = _pinA.read_u16();
- printf("%f\r\n",a);
- if(a<16384){
- return 0;
- }else if(a> 16383 && a<32768){
+ printf("CO ADC Value = %f\r\n",a);
+ if(a<20000){
return 1;
- }else if(a>32767 && a<49152){
+ }else if(a> 20000 && a<26000){
return 2;
+ }else if(a>=26000 && a<49152){
+ return 3;
}else{
return 3;
}