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
- Committer:
- christodoulos
- Date:
- 2019-03-22
- Revision:
- 0:958e045ea7d1
- Child:
- 1:9e66f21600f3
File content as of revision 0:958e045ea7d1:
#include "mbed.h" Serial co2(D1,D0); int value; int carbon() { bool allow = false; char c; char co2_measure[5]; int count=0; while(1) { c = co2.getc(); if(c=='Z') { allow = true; } if(allow) { if(c>=48 && c<=57) { co2_measure[count]=c; count++; } if(count>=5) { value = ((co2_measure[1]-'0')*100000+co2_measure[2]-'0')*10000+(co2_measure[3]-'0')*1000+(co2_measure[4]-'0')*100; count=0; allow=false; return value; } } } }