public class MCP3008GpioProvider extends GpioProviderBase implements GpioProvider
This GPIO provider implements the MCP3008 SPI GPIO expansion board as native Pi4J GPIO pins. It is a 10-bit ADC providing 8 input channels. More information about the board can be found here: http://ww1.microchip.com/downloads/en/DeviceDoc/21295d.pdf
The MCP3008 is connected via SPI connection to the Raspberry Pi and provides 8 GPIO pins that can be used for analog input pins. The values returned are in the range 0-1023 (max 10 bit value).
| Modifier and Type | Field and Description |
|---|---|
static String |
DESCRIPTION |
static int |
INVALID_VALUE |
static String |
NAME |
cache, isshutdown, listeners| Constructor and Description |
|---|
MCP3008GpioProvider(SpiChannel spiChannel)
Create new instance of this MCP3008 provider.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getName() |
double |
getValue(Pin pin) |
addListener, dispatchPinAnalogValueChangeEvent, dispatchPinDigitalStateChangeEvent, export, export, getMode, getPinCache, getPullResistance, getPwm, getState, hasPin, isExported, isShutdown, removeAllListeners, removeListener, setMode, setPullResistance, setPwm, setState, setValue, shutdown, unexportclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddListener, export, export, getMode, getPullResistance, getPwm, getState, hasPin, isExported, isShutdown, removeAllListeners, removeListener, setMode, setPullResistance, setPwm, setState, setValue, shutdown, unexportpublic static final String NAME
public static final String DESCRIPTION
public static final int INVALID_VALUE
public MCP3008GpioProvider(SpiChannel spiChannel) throws IOException
spiChannel - spi channel the MCP3008 is connected toIOException - if an error occurs during initialization of the SpiDevicepublic String getName()
getName in interface GpioProvidergetName in class GpioProviderBasepublic double getValue(Pin pin)
getValue in interface GpioProvidergetValue in class GpioProviderBaseCopyright © 2012–2015 Pi4J. All rights reserved.