Skip to content
This repository was archived by the owner on Oct 24, 2018. It is now read-only.

Files

Latest commit

a33fbf0 · Nov 4, 2017

History

History

mcp3008

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Apr 6, 2017
Nov 4, 2017

Read value from ADT MCP3008

Example

package main

import (
        "time"
        "fmt"
        mcp "github.com/jdevelop/golang-rpi-extras/mcp3008"
        )

func main() {

	const channel = 0

	// /dev/spidev0.0
	mcp, err := mcp.NewMCP3008(0, 0, mcp.Mode0, 500000)
	
	if err != nil {
		panic(err.Error())
	}

	for {
		fmt.Println(mcp.Measure(channel))
		time.Sleep(time.Second)
	}

}