Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
co2.h
00001 #include "mbed.h" 00002 00003 Serial co2(D1,D0); //USED IN MAIN 00004 00005 00006 int value; 00007 00008 int carbon() 00009 { 00010 bool allow = false; 00011 char c; 00012 char co2_measure[5]; 00013 int count=0; 00014 00015 while(1) { 00016 c = co2.getc(); 00017 if(c=='Z') { 00018 allow = true; 00019 } 00020 00021 if(allow) { 00022 if(c>=48 && c<=57) { 00023 co2_measure[count]=c; 00024 count++; 00025 } 00026 00027 if(count>=6) { //NOT SURE IF 5 OR 6 00028 value = ((co2_measure[0]-'0')*100000+co2_measure[1]-'0')*10000+(co2_measure[2]-'0')*1000+(co2_measure[3]-'0')*100; 00029 count=0; 00030 allow=false; 00031 return value; 00032 } 00033 } 00034 } 00035 } 00036
Generated on Sun Jul 31 2022 08:45:37 by
1.7.2