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) |
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, PlatformAlreadyAssignedException
public static void read()
throws IOException,
InterruptedException
IOExceptionInterruptedExceptionpublic static int getConversionValue(short channel)
throws IOException
channel - analog input channel on ADC chipIOExceptionCopyright © 2012–2018 Pi4J. All rights reserved.