Package com.tinkerforge
Class BrickletServoV2
- java.lang.Object
-
- com.tinkerforge.DeviceBase
-
- com.tinkerforge.Device
-
- com.tinkerforge.BrickletServoV2
-
public class BrickletServoV2 extends Device
Drives up to 10 RC Servos
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
BrickletServoV2.Degree
class
BrickletServoV2.MotionConfiguration
static interface
BrickletServoV2.PositionReachedListener
This listener is triggered when a position set bysetPosition(int, int)
is reached.class
BrickletServoV2.PulseWidth
class
BrickletServoV2.SPITFPErrorCount
class
BrickletServoV2.Status
-
Nested classes/interfaces inherited from class com.tinkerforge.Device
Device.Identity
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description BrickletServoV2(java.lang.String uid, IPConnection ipcon)
Creates an object with the unique device ID \c uid.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPositionReachedListener(BrickletServoV2.PositionReachedListener listener)
Adds a PositionReached listener.int
getBootloaderMode()
Returns the current bootloader mode, seesetBootloaderMode(int)
.int
getChipTemperature()
Returns the temperature as measured inside the microcontroller.int[]
getCurrentCalibration()
Returns the current calibration as set bysetCurrentCalibration(int[])
.int
getCurrentPosition(int servoChannel)
Returns the *current* position of the specified servo channel.int
getCurrentVelocity(int servoChannel)
Returns the *current* velocity of the specified servo channel.BrickletServoV2.Degree
getDegree(int servoChannel)
Returns the minimum and maximum degree for the specified servo channel as set bysetDegree(int, int, int)
.boolean
getEnabled(int servoChannel)
Returns *true* if the specified servo channel is enabled, *false* otherwise.Device.Identity
getIdentity()
Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.int
getInputVoltage()
Returns the input voltage in mV.int
getInputVoltageConfiguration()
Returns the input voltage configuration as set bysetInputVoltageConfiguration(int)
.BrickletServoV2.MotionConfiguration
getMotionConfiguration(int servoChannel)
Returns the motion configuration as set bysetMotionConfiguration(int, long, long, long)
.int
getOverallCurrent()
Returns the current consumption of all servos together in mA.long
getPeriod(int servoChannel)
Returns the period for the specified servo channel as set bysetPeriod(int, long)
.int
getPosition(int servoChannel)
Returns the position of the specified servo channel as set bysetPosition(int, int)
.boolean
getPositionReachedCallbackConfiguration(int servoChannel)
Returns the listener configuration as set bysetPositionReachedCallbackConfiguration(int, boolean)
.BrickletServoV2.PulseWidth
getPulseWidth(int servoChannel)
Returns the minimum and maximum pulse width for the specified servo channel as set bysetPulseWidth(int, long, long)
.int
getServoCurrent(int servoChannel)
Returns the current consumption of the specified servo channel in mA.int
getServoCurrentConfiguration(int servoChannel)
Returns the servo current configuration for the specified servo channel as set bysetServoCurrentConfiguration(int, int)
.BrickletServoV2.SPITFPErrorCount
getSPITFPErrorCount()
Returns the error count for the communication between Brick and Bricklet.BrickletServoV2.Status
getStatus()
Returns the status information of the Servo Bricklet 2.0.int
getStatusLEDConfig()
Returns the configuration as set bysetStatusLEDConfig(int)
long
readUID()
Returns the current UID as an integer.void
removePositionReachedListener(BrickletServoV2.PositionReachedListener listener)
Removes a PositionReached listener.void
reset()
Calling this function will reset the Bricklet.int
setBootloaderMode(int mode)
Sets the bootloader mode and returns the status after the requested mode change was instigated.void
setCurrentCalibration(int[] offset)
Sets an offset value (in mA) for each channel.void
setDegree(int servoChannel, int min, int max)
Sets the minimum and maximum degree for the specified servo channel (by default given as °/100).void
setEnable(int servoChannel, boolean enable)
Enables a servo channel (0 to 9).void
setInputVoltageConfiguration(int averagingDuration)
Sets the averaging duration of the input voltage measurement for the specified servo channel in ms.void
setMotionConfiguration(int servoChannel, long velocity, long acceleration, long deceleration)
Sets the maximum velocity of the specified servo channel in °/100s as well as the acceleration and deceleration in °/100s² With a velocity of 0 °/100s the position will be set immediately (no velocity).void
setPeriod(int servoChannel, long period)
Sets the period of the specified servo channel in µs.void
setPosition(int servoChannel, int position)
Sets the position in °/100 for the specified servo channel.void
setPositionReachedCallbackConfiguration(int servoChannel, boolean enabled)
Enable/DisableBrickletServoV2.PositionReachedListener
listener.void
setPulseWidth(int servoChannel, long min, long max)
Sets the minimum and maximum pulse width of the specified servo channel in µs.void
setServoCurrentConfiguration(int servoChannel, int averagingDuration)
Sets the averaging duration of the current measurement for the specified servo channel in ms.void
setStatusLEDConfig(int config)
Sets the status LED configuration.void
setWriteFirmwarePointer(long pointer)
Sets the firmware pointer forwriteFirmware(int[])
.int
writeFirmware(int[] data)
Writes 64 Bytes of firmware at the position as written bysetWriteFirmwarePointer(long)
before.void
writeUID(long uid)
Writes a new UID into flash.-
Methods inherited from class com.tinkerforge.DeviceBase
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
-
-
-
-
Field Detail
-
DEVICE_IDENTIFIER
public static final int DEVICE_IDENTIFIER
- See Also:
- Constant Field Values
-
DEVICE_DISPLAY_NAME
public static final java.lang.String DEVICE_DISPLAY_NAME
- See Also:
- Constant Field Values
-
FUNCTION_GET_STATUS
public static final byte FUNCTION_GET_STATUS
- See Also:
- Constant Field Values
-
FUNCTION_SET_ENABLE
public static final byte FUNCTION_SET_ENABLE
- See Also:
- Constant Field Values
-
FUNCTION_GET_ENABLED
public static final byte FUNCTION_GET_ENABLED
- See Also:
- Constant Field Values
-
FUNCTION_SET_POSITION
public static final byte FUNCTION_SET_POSITION
- See Also:
- Constant Field Values
-
FUNCTION_GET_POSITION
public static final byte FUNCTION_GET_POSITION
- See Also:
- Constant Field Values
-
FUNCTION_GET_CURRENT_POSITION
public static final byte FUNCTION_GET_CURRENT_POSITION
- See Also:
- Constant Field Values
-
FUNCTION_GET_CURRENT_VELOCITY
public static final byte FUNCTION_GET_CURRENT_VELOCITY
- See Also:
- Constant Field Values
-
FUNCTION_SET_MOTION_CONFIGURATION
public static final byte FUNCTION_SET_MOTION_CONFIGURATION
- See Also:
- Constant Field Values
-
FUNCTION_GET_MOTION_CONFIGURATION
public static final byte FUNCTION_GET_MOTION_CONFIGURATION
- See Also:
- Constant Field Values
-
FUNCTION_SET_PULSE_WIDTH
public static final byte FUNCTION_SET_PULSE_WIDTH
- See Also:
- Constant Field Values
-
FUNCTION_GET_PULSE_WIDTH
public static final byte FUNCTION_GET_PULSE_WIDTH
- See Also:
- Constant Field Values
-
FUNCTION_SET_DEGREE
public static final byte FUNCTION_SET_DEGREE
- See Also:
- Constant Field Values
-
FUNCTION_GET_DEGREE
public static final byte FUNCTION_GET_DEGREE
- See Also:
- Constant Field Values
-
FUNCTION_SET_PERIOD
public static final byte FUNCTION_SET_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_PERIOD
public static final byte FUNCTION_GET_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_SERVO_CURRENT
public static final byte FUNCTION_GET_SERVO_CURRENT
- See Also:
- Constant Field Values
-
FUNCTION_SET_SERVO_CURRENT_CONFIGURATION
public static final byte FUNCTION_SET_SERVO_CURRENT_CONFIGURATION
- See Also:
- Constant Field Values
-
FUNCTION_GET_SERVO_CURRENT_CONFIGURATION
public static final byte FUNCTION_GET_SERVO_CURRENT_CONFIGURATION
- See Also:
- Constant Field Values
-
FUNCTION_SET_INPUT_VOLTAGE_CONFIGURATION
public static final byte FUNCTION_SET_INPUT_VOLTAGE_CONFIGURATION
- See Also:
- Constant Field Values
-
FUNCTION_GET_INPUT_VOLTAGE_CONFIGURATION
public static final byte FUNCTION_GET_INPUT_VOLTAGE_CONFIGURATION
- See Also:
- Constant Field Values
-
FUNCTION_GET_OVERALL_CURRENT
public static final byte FUNCTION_GET_OVERALL_CURRENT
- See Also:
- Constant Field Values
-
FUNCTION_GET_INPUT_VOLTAGE
public static final byte FUNCTION_GET_INPUT_VOLTAGE
- See Also:
- Constant Field Values
-
FUNCTION_SET_CURRENT_CALIBRATION
public static final byte FUNCTION_SET_CURRENT_CALIBRATION
- See Also:
- Constant Field Values
-
FUNCTION_GET_CURRENT_CALIBRATION
public static final byte FUNCTION_GET_CURRENT_CALIBRATION
- See Also:
- Constant Field Values
-
FUNCTION_SET_POSITION_REACHED_CALLBACK_CONFIGURATION
public static final byte FUNCTION_SET_POSITION_REACHED_CALLBACK_CONFIGURATION
- See Also:
- Constant Field Values
-
FUNCTION_GET_POSITION_REACHED_CALLBACK_CONFIGURATION
public static final byte FUNCTION_GET_POSITION_REACHED_CALLBACK_CONFIGURATION
- See Also:
- Constant Field Values
-
FUNCTION_GET_SPITFP_ERROR_COUNT
public static final byte FUNCTION_GET_SPITFP_ERROR_COUNT
- See Also:
- Constant Field Values
-
FUNCTION_SET_BOOTLOADER_MODE
public static final byte FUNCTION_SET_BOOTLOADER_MODE
- See Also:
- Constant Field Values
-
FUNCTION_GET_BOOTLOADER_MODE
public static final byte FUNCTION_GET_BOOTLOADER_MODE
- See Also:
- Constant Field Values
-
FUNCTION_SET_WRITE_FIRMWARE_POINTER
public static final byte FUNCTION_SET_WRITE_FIRMWARE_POINTER
- See Also:
- Constant Field Values
-
FUNCTION_WRITE_FIRMWARE
public static final byte FUNCTION_WRITE_FIRMWARE
- See Also:
- Constant Field Values
-
FUNCTION_SET_STATUS_LED_CONFIG
public static final byte FUNCTION_SET_STATUS_LED_CONFIG
- See Also:
- Constant Field Values
-
FUNCTION_GET_STATUS_LED_CONFIG
public static final byte FUNCTION_GET_STATUS_LED_CONFIG
- See Also:
- Constant Field Values
-
FUNCTION_GET_CHIP_TEMPERATURE
public static final byte FUNCTION_GET_CHIP_TEMPERATURE
- See Also:
- Constant Field Values
-
FUNCTION_RESET
public static final byte FUNCTION_RESET
- See Also:
- Constant Field Values
-
FUNCTION_WRITE_UID
public static final byte FUNCTION_WRITE_UID
- See Also:
- Constant Field Values
-
FUNCTION_READ_UID
public static final byte FUNCTION_READ_UID
- See Also:
- Constant Field Values
-
FUNCTION_GET_IDENTITY
public static final byte FUNCTION_GET_IDENTITY
- See Also:
- Constant Field Values
-
BOOTLOADER_MODE_BOOTLOADER
public static final int BOOTLOADER_MODE_BOOTLOADER
- See Also:
- Constant Field Values
-
BOOTLOADER_MODE_FIRMWARE
public static final int BOOTLOADER_MODE_FIRMWARE
- See Also:
- Constant Field Values
-
BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT
public static final int BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT
- See Also:
- Constant Field Values
-
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT
public static final int BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT
- See Also:
- Constant Field Values
-
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT
public static final int BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT
- See Also:
- Constant Field Values
-
BOOTLOADER_STATUS_OK
public static final int BOOTLOADER_STATUS_OK
- See Also:
- Constant Field Values
-
BOOTLOADER_STATUS_INVALID_MODE
public static final int BOOTLOADER_STATUS_INVALID_MODE
- See Also:
- Constant Field Values
-
BOOTLOADER_STATUS_NO_CHANGE
public static final int BOOTLOADER_STATUS_NO_CHANGE
- See Also:
- Constant Field Values
-
BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT
public static final int BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT
- See Also:
- Constant Field Values
-
BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT
public static final int BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT
- See Also:
- Constant Field Values
-
BOOTLOADER_STATUS_CRC_MISMATCH
public static final int BOOTLOADER_STATUS_CRC_MISMATCH
- See Also:
- Constant Field Values
-
STATUS_LED_CONFIG_OFF
public static final int STATUS_LED_CONFIG_OFF
- See Also:
- Constant Field Values
-
STATUS_LED_CONFIG_ON
public static final int STATUS_LED_CONFIG_ON
- See Also:
- Constant Field Values
-
STATUS_LED_CONFIG_SHOW_HEARTBEAT
public static final int STATUS_LED_CONFIG_SHOW_HEARTBEAT
- See Also:
- Constant Field Values
-
STATUS_LED_CONFIG_SHOW_STATUS
public static final int STATUS_LED_CONFIG_SHOW_STATUS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BrickletServoV2
public BrickletServoV2(java.lang.String uid, IPConnection ipcon)
Creates an object with the unique device ID \c uid. and adds it to the IP Connection \c ipcon.
-
-
Method Detail
-
getStatus
public BrickletServoV2.Status getStatus() throws TinkerforgeException
Returns the status information of the Servo Bricklet 2.0. The status includes * for each channel if it is enabled or disabled, * for each channel the current position, * for each channel the current velocity, * for each channel the current usage and * the input voltage. Please note that the position and the velocity is a snapshot of the current position and velocity of the servo in motion.- Throws:
TinkerforgeException
-
setEnable
public void setEnable(int servoChannel, boolean enable) throws TinkerforgeException
Enables a servo channel (0 to 9). If a servo is enabled, the configured position, velocity, acceleration, etc. are applied immediately.- Throws:
TinkerforgeException
-
getEnabled
public boolean getEnabled(int servoChannel) throws TinkerforgeException
Returns *true* if the specified servo channel is enabled, *false* otherwise.- Throws:
TinkerforgeException
-
setPosition
public void setPosition(int servoChannel, int position) throws TinkerforgeException
Sets the position in °/100 for the specified servo channel. The default range of the position is -9000 to 9000, but it can be specified according to your servo withsetDegree(int, int, int)
. If you want to control a linear servo or RC brushless motor controller or similar with the Servo Brick, you can also define lengths or speeds withsetDegree(int, int, int)
.- Throws:
TinkerforgeException
-
getPosition
public int getPosition(int servoChannel) throws TinkerforgeException
Returns the position of the specified servo channel as set bysetPosition(int, int)
.- Throws:
TinkerforgeException
-
getCurrentPosition
public int getCurrentPosition(int servoChannel) throws TinkerforgeException
Returns the *current* position of the specified servo channel. This may not be the value ofsetPosition(int, int)
if the servo is currently approaching a position goal.- Throws:
TinkerforgeException
-
getCurrentVelocity
public int getCurrentVelocity(int servoChannel) throws TinkerforgeException
Returns the *current* velocity of the specified servo channel. This may not be the velocity specified bysetMotionConfiguration(int, long, long, long)
. if the servo is currently approaching a velocity goal.- Throws:
TinkerforgeException
-
setMotionConfiguration
public void setMotionConfiguration(int servoChannel, long velocity, long acceleration, long deceleration) throws TinkerforgeException
Sets the maximum velocity of the specified servo channel in °/100s as well as the acceleration and deceleration in °/100s² With a velocity of 0 °/100s the position will be set immediately (no velocity). With an acc-/deceleration of 0 °/100s² the velocity will be set immediately (no acc-/deceleration).- Throws:
TinkerforgeException
-
getMotionConfiguration
public BrickletServoV2.MotionConfiguration getMotionConfiguration(int servoChannel) throws TinkerforgeException
Returns the motion configuration as set bysetMotionConfiguration(int, long, long, long)
.- Throws:
TinkerforgeException
-
setPulseWidth
public void setPulseWidth(int servoChannel, long min, long max) throws TinkerforgeException
Sets the minimum and maximum pulse width of the specified servo channel in µs. Usually, servos are controlled with a `PWM <https://en.wikipedia.org/wiki/Pulse-width_modulation>`__, whereby the length of the pulse controls the position of the servo. Every servo has different minimum and maximum pulse widths, these can be specified with this function. If you have a datasheet for your servo that specifies the minimum and maximum pulse width, you should set the values accordingly. If your servo comes without any datasheet you have to find the values via trial and error. Both values have a range from 1 to 65535 (unsigned 16-bit integer). The minimum must be smaller than the maximum. The default values are 1000µs (1ms) and 2000µs (2ms) for minimum and maximum pulse width.- Throws:
TinkerforgeException
-
getPulseWidth
public BrickletServoV2.PulseWidth getPulseWidth(int servoChannel) throws TinkerforgeException
Returns the minimum and maximum pulse width for the specified servo channel as set bysetPulseWidth(int, long, long)
.- Throws:
TinkerforgeException
-
setDegree
public void setDegree(int servoChannel, int min, int max) throws TinkerforgeException
Sets the minimum and maximum degree for the specified servo channel (by default given as °/100). This only specifies the abstract values between which the minimum and maximum pulse width is scaled. For example: If you specify a pulse width of 1000µs to 2000µs and a degree range of -90° to 90°, a call ofsetPosition(int, int)
with 0 will result in a pulse width of 1500µs (-90° = 1000µs, 90° = 2000µs, etc.). Possible usage: * The datasheet of your servo specifies a range of 200° with the middle position at 110°. In this case you can set the minimum to -9000 and the maximum to 11000. * You measure a range of 220° on your servo and you don't have or need a middle position. In this case you can set the minimum to 0 and the maximum to 22000. * You have a linear servo with a drive length of 20cm, In this case you could set the minimum to 0 and the maximum to 20000. Now you can set the Position withsetPosition(int, int)
with a resolution of cm/100. Also the velocity will have a resolution of cm/100s and the acceleration will have a resolution of cm/100s². * You don't care about units and just want the highest possible resolution. In this case you should set the minimum to -32767 and the maximum to 32767. * You have a brushless motor with a maximum speed of 10000 rpm and want to control it with a RC brushless motor controller. In this case you can set the minimum to 0 and the maximum to 10000.setPosition(int, int)
now controls the rpm. Both values have a possible range from -32767 to 32767 (signed 16-bit integer). The minimum must be smaller than the maximum. The default values are -9000 and 9000 for the minimum and maximum degree.- Throws:
TinkerforgeException
-
getDegree
public BrickletServoV2.Degree getDegree(int servoChannel) throws TinkerforgeException
Returns the minimum and maximum degree for the specified servo channel as set bysetDegree(int, int, int)
.- Throws:
TinkerforgeException
-
setPeriod
public void setPeriod(int servoChannel, long period) throws TinkerforgeException
Sets the period of the specified servo channel in µs. Usually, servos are controlled with a `PWM <https://en.wikipedia.org/wiki/Pulse-width_modulation>`__. Different servos expect PWMs with different periods. Most servos run well with a period of about 20ms. If your servo comes with a datasheet that specifies a period, you should set it accordingly. If you don't have a datasheet and you have no idea what the correct period is, the default value (19.5ms) will most likely work fine. The minimum possible period is 1µs and the maximum is 1000000µs. The default value is 19.5ms (19500µs).- Throws:
TinkerforgeException
-
getPeriod
public long getPeriod(int servoChannel) throws TinkerforgeException
Returns the period for the specified servo channel as set bysetPeriod(int, long)
.- Throws:
TinkerforgeException
-
getServoCurrent
public int getServoCurrent(int servoChannel) throws TinkerforgeException
Returns the current consumption of the specified servo channel in mA.- Throws:
TinkerforgeException
-
setServoCurrentConfiguration
public void setServoCurrentConfiguration(int servoChannel, int averagingDuration) throws TinkerforgeException
Sets the averaging duration of the current measurement for the specified servo channel in ms.- Throws:
TinkerforgeException
-
getServoCurrentConfiguration
public int getServoCurrentConfiguration(int servoChannel) throws TinkerforgeException
Returns the servo current configuration for the specified servo channel as set bysetServoCurrentConfiguration(int, int)
.- Throws:
TinkerforgeException
-
setInputVoltageConfiguration
public void setInputVoltageConfiguration(int averagingDuration) throws TinkerforgeException
Sets the averaging duration of the input voltage measurement for the specified servo channel in ms.- Throws:
TinkerforgeException
-
getInputVoltageConfiguration
public int getInputVoltageConfiguration() throws TinkerforgeException
Returns the input voltage configuration as set bysetInputVoltageConfiguration(int)
.- Throws:
TinkerforgeException
-
getOverallCurrent
public int getOverallCurrent() throws TinkerforgeException
Returns the current consumption of all servos together in mA.- Throws:
TinkerforgeException
-
getInputVoltage
public int getInputVoltage() throws TinkerforgeException
Returns the input voltage in mV. The input voltage is given via the black power input connector on the Servo Brick.- Throws:
TinkerforgeException
-
setCurrentCalibration
public void setCurrentCalibration(int[] offset) throws TinkerforgeException
Sets an offset value (in mA) for each channel. Note: On delivery the Servo Bricklet 2.0 is already calibrated.- Throws:
TinkerforgeException
-
getCurrentCalibration
public int[] getCurrentCalibration() throws TinkerforgeException
Returns the current calibration as set bysetCurrentCalibration(int[])
.- Throws:
TinkerforgeException
-
setPositionReachedCallbackConfiguration
public void setPositionReachedCallbackConfiguration(int servoChannel, boolean enabled) throws TinkerforgeException
Enable/DisableBrickletServoV2.PositionReachedListener
listener.- Throws:
TinkerforgeException
-
getPositionReachedCallbackConfiguration
public boolean getPositionReachedCallbackConfiguration(int servoChannel) throws TinkerforgeException
Returns the listener configuration as set bysetPositionReachedCallbackConfiguration(int, boolean)
.- Throws:
TinkerforgeException
-
getSPITFPErrorCount
public BrickletServoV2.SPITFPErrorCount getSPITFPErrorCount() throws TinkerforgeException
Returns the error count for the communication between Brick and Bricklet. The errors are divided into * ACK checksum errors, * message checksum errors, * framing errors and * overflow errors. The errors counts are for errors that occur on the Bricklet side. All Bricks have a similar function that returns the errors on the Brick side.- Throws:
TinkerforgeException
-
setBootloaderMode
public int setBootloaderMode(int mode) throws TinkerforgeException
Sets the bootloader mode and returns the status after the requested mode change was instigated. You can change from bootloader mode to firmware mode and vice versa. A change from bootloader mode to firmware mode will only take place if the entry function, device identifier and CRC are present and correct. This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.- Throws:
TinkerforgeException
-
getBootloaderMode
public int getBootloaderMode() throws TinkerforgeException
Returns the current bootloader mode, seesetBootloaderMode(int)
.- Throws:
TinkerforgeException
-
setWriteFirmwarePointer
public void setWriteFirmwarePointer(long pointer) throws TinkerforgeException
Sets the firmware pointer forwriteFirmware(int[])
. The pointer has to be increased by chunks of size 64. The data is written to flash every 4 chunks (which equals to one page of size 256). This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.- Throws:
TinkerforgeException
-
writeFirmware
public int writeFirmware(int[] data) throws TinkerforgeException
Writes 64 Bytes of firmware at the position as written bysetWriteFirmwarePointer(long)
before. The firmware is written to flash every 4 chunks. You can only write firmware in bootloader mode. This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.- Throws:
TinkerforgeException
-
setStatusLEDConfig
public void setStatusLEDConfig(int config) throws TinkerforgeException
Sets the status LED configuration. By default the LED shows communication traffic between Brick and Bricklet, it flickers once for every 10 received data packets. You can also turn the LED permanently on/off or show a heartbeat. If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.- Throws:
TinkerforgeException
-
getStatusLEDConfig
public int getStatusLEDConfig() throws TinkerforgeException
Returns the configuration as set bysetStatusLEDConfig(int)
- Throws:
TinkerforgeException
-
getChipTemperature
public int getChipTemperature() throws TinkerforgeException
Returns the temperature as measured inside the microcontroller. The value returned is not the ambient temperature! The temperature is only proportional to the real temperature and it has bad accuracy. Practically it is only useful as an indicator for temperature changes.- Throws:
TinkerforgeException
-
reset
public void reset() throws TinkerforgeException
Calling this function will reset the Bricklet. All configurations will be lost. After a reset you have to create new device objects, calling functions on the existing ones will result in undefined behavior!- Throws:
TinkerforgeException
-
writeUID
public void writeUID(long uid) throws TinkerforgeException
Writes a new UID into flash. If you want to set a new UID you have to decode the Base58 encoded UID string into an integer first. We recommend that you use Brick Viewer to change the UID.- Throws:
TinkerforgeException
-
readUID
public long readUID() throws TinkerforgeException
Returns the current UID as an integer. Encode as Base58 to get the usual string version.- Throws:
TinkerforgeException
-
getIdentity
public Device.Identity getIdentity() throws TinkerforgeException
Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier. The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port). A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at position 'z'. The device identifier numbers can be found :ref:`here <device_identifier>`. |device_identifier_constant|- Specified by:
getIdentity
in classDevice
- Throws:
TinkerforgeException
-
addPositionReachedListener
public void addPositionReachedListener(BrickletServoV2.PositionReachedListener listener)
Adds a PositionReached listener.
-
removePositionReachedListener
public void removePositionReachedListener(BrickletServoV2.PositionReachedListener listener)
Removes a PositionReached listener.
-
-