mcp3008

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 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 (
	// 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 byte

	Bus embd.SPIBus
}

MCP3008 represents a mcp3008 8bit DAC.

func New

func New(mode 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