Skip to content

macaron/go-mh-z19b

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-mh-z19b

二酸化炭素濃度計「MH-Z19B」のGo言語ライブラリ

センサーについて

MH-Z19B(データシート) は安価な二酸化炭素濃度計として有名です。

インストール

$ go get -u github.com/macaron/go-mh-z19b

サンプルコード

func main() {
    mhz19b := mhz19b.New("/dev/serial0")
    ppm, err := mhz19b.Read()
    
    if err != nil {
    	log.Fetal(err)
    }
    fmt.Printf("CO2 = %dppm\n", ppm)

    // If you want to reset the sensor ZERO point
    // mhz19b.CalibrateDefault()
}

About

Golang library to interact with MH-Z19B from RaspberryPi.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published