|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.dexterind.gopigo.components.Board
public class Board
Defines all the methods to get access to the resources connected to the board. It also returns the status, the voltage and the firmware version of the board.
| Field Summary | |
|---|---|
private static byte |
ADDRESS
The device's address. |
private Debug |
debug
The debug object. |
private I2CDevice |
device
The I2CDevice object. |
private static Board |
instance
The instance of the current object. |
private static byte |
PIN_MODE_INPUT
The input mode for the pin. |
private static byte |
PIN_MODE_OUTPUT
The output mode for the pin. |
| Constructor Summary | |
|---|---|
Board()
|
|
| Method Summary | |
|---|---|
int |
analogRead(int pin)
Executes an analog read on the pin. |
int |
analogWrite(int pin,
int value)
Executes an analog write on the pin. |
int |
digitalRead(int pin)
Executes a digital read on the pin. |
int |
digitalWrite(int pin,
int value)
Executes a digital write on the pin. |
static Board |
getInstance()
Provides a global point of access to the Board instance. |
void |
init()
Initializes the board executing a writing test catching the error. |
byte[] |
readI2c(int numberOfBytes)
Reads the number of bytes from the I2C device. |
int[] |
readStatus()
Reads the current status. |
int |
revision()
Returns the board revision. |
int |
setPinMode(int pin,
int pinMode)
Sets the pin mode to use on the pin. |
void |
sleep(int msec)
Executes a sleep on the thread for the number of milliseconds. |
float |
version()
Returns the firmware version. |
double |
volt()
Returns the current voltage on the board. |
int |
writeI2c(int... bytes)
Writes the bytes to the I2C device. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static Board instance
private final I2CDevice device
private static final byte PIN_MODE_OUTPUT
private static final byte PIN_MODE_INPUT
private static final byte ADDRESS
private Debug debug
| Constructor Detail |
|---|
public Board()
throws java.io.IOException,
java.lang.InterruptedException
java.io.IOException
java.lang.InterruptedException| Method Detail |
|---|
public static Board getInstance()
throws java.io.IOException,
java.lang.InterruptedException
Board instance.
java.io.IOException
java.lang.InterruptedException
public int writeI2c(int... bytes)
throws java.io.IOException
bytes - The buffer to write.
java.io.IOException
public byte[] readI2c(int numberOfBytes)
throws java.io.IOException
numberOfBytes - The length of the buffer to read.
java.io.IOException
public int digitalRead(int pin)
throws java.io.IOException
pin - The pin to use for the reading.
java.io.IOException
public int digitalWrite(int pin,
int value)
throws java.io.IOException
pin - The ping to use for the writing.value - The value to write.
java.io.IOException
public int analogRead(int pin)
throws java.io.IOException
pin - The ping to use for the reading.
java.io.IOException
public int analogWrite(int pin,
int value)
throws java.io.IOException
pin - The ping to use for the writing.value - The value to write.
java.io.IOException
public int setPinMode(int pin,
int pinMode)
throws java.io.IOException
pin - The ping to set.pinMode - The mode to set. 1 is OUTPUT, 0 is INPUT
java.io.IOExceptionpublic void sleep(int msec)
msec - The value of the sleep in milliseconds.public void init()
public double volt()
throws java.io.IOException
java.io.IOException
public float version()
throws java.io.IOException
java.io.IOException
public int revision()
throws java.io.IOException
java.io.IOException
public int[] readStatus()
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||