embd: github.com/kidoman/embd/convertors/mcp3008 Index | Files

package mcp3008

import "github.com/kidoman/embd/convertors/mcp3008"

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


Package Files



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

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

type MCP3008 Uses

type MCP3008 struct {
    Mode byte

    Bus embd.SPIBus

MCP3008 represents a mcp3008 8bit DAC.

func New Uses

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

New creates a representation of the mcp3008 convertor

func (*MCP3008) AnalogValueAt Uses

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

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

Package mcp3008 imports 2 packages (graph) and is imported by 2 packages. Updated 2016-07-16. Refresh now. Tools for package owners.