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.

          Source Files