mcp3008

package
v0.0.0-...-1cd92e3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2016 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package mcp3008 allows interfacing with the mcp3008 8-channel, 10-bit ADC through SPI protocol.

Index

Constants

View Source
const (
	Bits10 = iota //10 bit MCP300** family
	Bits12        //12 bit MCP320** family
)

How many bits does the

View Source
const (
	// SingleMode represents the single-ended mode for the mcp3008.
	SingleMode = 1

	// DifferenceMode represents the diffenrential mode for the mcp3008.
	DifferenceMode = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MCP3008

type MCP3008 struct {
	Mode, Bits byte
	Bus        embd.SPIBus
}

MCP3008 represents a mcp3008 8bit DAC.

func New

func New(mode, bits byte, bus embd.SPIBus) *MCP3008

New creates a representation of the mcp3008 convertor

func (*MCP3008) AnalogValueAt

func (m *MCP3008) AnalogValueAt(chanNum int) (int, error)

AnalogValueAt returns the analog value at the given channel of the convertor.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL