|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthypermedia.pinguino.Pinguino
public class Pinguino
Main object to communicate with Pinguino board via USB port.
You can test all implemented method with this small program.
Field Summary | |
---|---|
int |
DEFAULT_TIMEOUT
Default timeout value in milliseconds. |
static String |
errmsg
The last error message |
static int |
HIGH
Digital pin status. |
static int |
LOW
|
Constructor Summary | |
---|---|
Pinguino()
Create a new Pinguino object and initialize board connection. |
|
Pinguino(PApplet parent)
Create a new Pinguino object and initialize board connection. |
Method Summary | |
---|---|
int |
analogRead(int pin)
Retrieve the specified analog pin value. |
void |
analogWrite(int pin,
int value)
Send the given value to the specified analog pin number. |
void |
clear()
Clear all pin values. |
int |
digitalRead(int pin)
Retrieve the specified digital pin value. |
void |
digitalWrite(int pin,
int value)
Send the given value to the specified pin number. |
void |
dispose()
Clear all pins value and close device connection. |
static void |
log(boolean enable)
Enable/disable status updates. This method is static and should be called before creating the Pinguino object. |
byte[] |
read(byte[] result)
Retrieve the latest message from Pinguino device with the default timeout value. |
byte[] |
read(byte[] result,
int timeout)
Retrieve the latest message from Pinguino device with an optional timeout value. |
void |
write(byte[] data)
Send the given data to Pinguino device. |
void |
write(byte[] data,
int timeout)
Send the given data to Pinguino device with an optional timeout value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int HIGH
public static final int LOW
public final int DEFAULT_TIMEOUT
public static String errmsg
Constructor Detail |
---|
public Pinguino()
public Pinguino(PApplet parent)
parent
- the Processing PApplet object (typically use "this")Method Detail |
---|
public void dispose()
public void write(byte[] data)
data
- data as byte array to be sentwrite( byte[] )
,
read( byte[] )
,
read( byte[], int )
public void write(byte[] data, int timeout)
data
- data as byte array to be senttimeout
- amount of time in milliseconds the device will try to send the datawrite( byte[] )
,
read( byte[] )
,
read( byte[], int )
public void digitalWrite(int pin, int value)
pin
- the target pin numbervalue
- the new pin value ( 1, HIGH, 0, LOW )HIGH
,
LOW
,
analogWrite( int, int )
public void analogWrite(int pin, int value)
pin
- the target pin numbervalue
- the new pin value ( 0 - 1024 )digitalWrite( int, int )
public byte[] read(byte[] result)
result
- the data list to be returnedread( byte[], int )
,
write( byte[], int )
,
write( byte[] )
public byte[] read(byte[] result, int timeout)
result
- the data list to be returnedtimeout
- amount of time in milliseconds the device will try to give the dataread( byte[] )
,
write( byte[] )
,
write( byte[], int )
public int digitalRead(int pin)
pin
- the pin index
digitalWrite( int, int )
,
analogWrite( int, int )
,
analogRead( int )
public int analogRead(int pin)
pin
- the pin index
analogWrite( int, int )
,
digitalWrite( int, int )
,
digitalRead( int )
public void clear()
public static void log(boolean enable)
enable
- enable/disable status updates, disabled by default
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |