Last active
January 3, 2020 04:59
-
-
Save gvenzl/25e71ba2ccab9f7693de2a74ab00aac3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# Press [Ctrl]+[C] to terminate the program | |
from grove.grove_air_quality_sensor_v1_3 import GroveAirQualitySensor | |
air_quality_sensor = GroveAirQualitySensor(0) # Pin 0 for A0 | |
try: | |
while True: | |
# pollution ratio: 0(0.0% and best air quality) - 1000(100.0% worst air quality) | |
value = air_quality_sensor.value | |
pollution_percent = value / 10 | |
print("Air pollution at {0:.1f}%".format(pollution_percent)) | |
except KeyboardInterrupt: | |
print("Exiting program.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment