Skip to content

Instantly share code, notes, and snippets.

@benevolent0505
Created October 14, 2018 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benevolent0505/a60634b0f6193cbd3a34d2840f686705 to your computer and use it in GitHub Desktop.
Save benevolent0505/a60634b0f6193cbd3a34d2840f686705 to your computer and use it in GitHub Desktop.
py-co2mini
from CO2Meter import *
import time
from datetime import datetime
sensor = CO2Meter("/dev/hidraw0")
time.sleep(5) # 認識待ち
data = sensor.get_data()
timestamp = int(time.time())
print("co2mini.co2\t{}\t{}".format(data["co2"], timestamp))
print("co2mini.temp\t{}\t{}".format(data["temperature"], timestamp))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment