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: Grove_Air_Quality_Sensor_Library mbed
main.cpp@0:2dbce8e35862, 2014-09-05 (annotated)
- Committer:
- mbedAustin
- Date:
- Fri Sep 05 03:39:31 2014 +0000
- Revision:
- 0:2dbce8e35862
- Child:
- 1:888328032581
Grove Air Quality sensor example application. Test the air quality every 5 seconds and report. Score quality from 0-100 like the daily weather report.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbedAustin | 0:2dbce8e35862 | 1 | #include "mbed.h" |
mbedAustin | 0:2dbce8e35862 | 2 | |
mbedAustin | 0:2dbce8e35862 | 3 | AnalogIn sensor(A0); |
mbedAustin | 0:2dbce8e35862 | 4 | |
mbedAustin | 0:2dbce8e35862 | 5 | int main() { |
mbedAustin | 0:2dbce8e35862 | 6 | float sensorValue; |
mbedAustin | 0:2dbce8e35862 | 7 | while (true) { |
mbedAustin | 0:2dbce8e35862 | 8 | sensorValue = sensor.read(); |
mbedAustin | 0:2dbce8e35862 | 9 | printf("\r Air Quality score = %3.2f",100 - (sensorValue*100)); |
mbedAustin | 0:2dbce8e35862 | 10 | wait(5); |
mbedAustin | 0:2dbce8e35862 | 11 | } |
mbedAustin | 0:2dbce8e35862 | 12 | } |