public class SpiExample extends Object
Modifier and Type | Field and Description |
---|---|
static short |
ADC_CHANNEL_COUNT |
protected static Console |
console |
static SpiDevice |
spi |
Constructor and Description |
---|
SpiExample() |
Modifier and Type | Method and Description |
---|---|
static int |
getConversionValue(short channel)
Communicate to the ADC chip via SPI to get single-ended conversion value for a specified channel.
|
static void |
main(String[] args)
Sample SPI Program
|
static void |
read()
Read data via SPI bus from MCP3002 chip.
|
public static SpiDevice spi
public static short ADC_CHANNEL_COUNT
protected static final Console console
public static void main(String[] args) throws InterruptedException, IOException
args
- (none)InterruptedException
IOException
public static void read() throws IOException, InterruptedException
IOException
InterruptedException
public static int getConversionValue(short channel) throws IOException
channel
- analog input channel on ADC chipIOException
Copyright © 2012–2016 Pi4J. All rights reserved.