Skip to content
/ mhz19 Public

Read CO2 concentration via MH-Z19 on Raspberry Pi

License

Notifications You must be signed in to change notification settings

kebhr/mhz19

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mhz19

Read CO2 concentration from MH-Z19 on Raspberry Pi.

Installation

$ go get github.com/kebhr/mhz19/cmd/mhz19

Usage

$ mhz19
{"co2": "554"}

Use as a library

package main

import (
	"log"
	"github.com/kebhr/mhz19"
)

func main() {
	m := mhz19.MHZ19{}
	myDevicePath := "/dev/ttyS0"
	if err := m.Connect(myDevicePath); err != nil {
		log.Fatal(err)
	}
	v, err := m.ReadCO2()
	if err != nil {
		log.Fatal(err)
	}
	log.Printf("CO2 Concentration: %dppm\n", v)
}

About

Read CO2 concentration via MH-Z19 on Raspberry Pi

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages