|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.bluemelon.bluesense.Device
org.bluemelon.bluesense.MotorDevice
public class MotorDevice
Interface to the dc motor module BM7005. The BM7005 can be used to control the speed of 2 dc motors.
| Field Summary | |
|---|---|
static int |
BSMOTOR_P1
Port value for pin 1 |
static int |
BSMOTOR_P2
Port value for pin 2 |
static int |
MOTORCOUNT
The number of motors that can be controlled |
static int |
PROXY_ID
|
static java.lang.String |
PROXY_TITLE
|
static int[] |
SUPPORTS
|
| Constructor Summary | |
|---|---|
MotorDevice(Master master,
int deviceId)
Creates a 'software' dc motor device proxy with a given id. |
|
| Method Summary | |
|---|---|
int |
getCurrentSpeed(int port)
Returns the current set speed of a specific motor. |
void |
getCurrentSpeeds(int[] speedArray)
Fills an array with the current set speeds. |
int |
getPendingSpeed(int port)
Returns the speed of a specific motor, which is currently underway to the device |
void |
getPendingSpeeds(int[] speeds)
Fills an array with speeds which are currently underway to the device |
boolean |
getRequestSetSpeedsDone()
Checks if the speed set request is finished |
long |
getTimeOutUs()
Returns the current set time out delay. |
void |
requestGetSpeeds()
Sends a request to retrieve the current set speeds |
void |
requestSetSpeed(int port,
int speed)
Requests the motor device to set one of its motors to a new speed |
void |
requestSetSpeeds(int relevantSpeeds,
int[] speeds)
Requests the motor device to set its motors to new speeds |
void |
setTimeOutUs(int timeOutUs)
Sets the time out value which is used to check if a request was acknowledged in the set time. |
| Methods inherited from class org.bluemelon.bluesense.Device |
|---|
addDeviceEventListener, detect, getFirmwareVersion, getId, getType, getTypeName, isAccessible, removeDeviceEventListener |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String PROXY_TITLE
public static final int PROXY_ID
public static final int[] SUPPORTS
public static final int MOTORCOUNT
public static final int BSMOTOR_P1
public static final int BSMOTOR_P2
| Constructor Detail |
|---|
public MotorDevice(Master master,
int deviceId)
master - deviceId - | Method Detail |
|---|
public void requestSetSpeeds(int relevantSpeeds,
int[] speeds)
relevantSpeeds - a bit mask indicating which motors to updatespeeds - a pointer to an array of byte speeds with enough space for all motors. @see MOTORCOUNT
Note that each speed is a value between -128 and 127. -128 to -1 represent a speed left, 0 stand still and 1 to 127 a speed right,
the actual physical speed depends on the specifications of the connected motor.
public void requestSetSpeed(int port,
int speed)
port - one of the port pin values. @see bsMotor_p1speed - an uint8_t representing the new speed of the motor.
Note that each speed is a value between -128 and 127. -128 to -1 represent a speed left, 0 stand still and 1 to 127 a speed right,
the actual physical speed depends on the specifications of the connected motor.public void requestGetSpeeds()
public void getPendingSpeeds(int[] speeds)
speeds - a pointer to an array of uint8_t speeds with enough space for all motors. @see BLUESENSE_MOTORCONTROLLER_MOTORCOUNTpublic int getPendingSpeed(int port)
port - one of the port pin values. @see bsMotor_p1
public boolean getRequestSetSpeedsDone()
public int getCurrentSpeed(int port)
port - one of the port pin values. @see bsMotor_p1
public void getCurrentSpeeds(int[] speedArray)
speedArray - a pointer to an array of uint8_t speeds with enough space for all motors. @see BLUESENSE_MOTORCONTROLLER_MOTORCOUNTpublic long getTimeOutUs()
public void setTimeOutUs(int timeOutUs)
timeOutUs - the value in microseconds which is the maximum duraion between a request and its answer.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||