MQTT - Servo Bricklet 2.0

This is the description of the MQTT API bindings for the Servo Bricklet 2.0. General information and technical specifications for the Servo Bricklet 2.0 are summarized in its hardware description.

An installation guide for the MQTT API bindings is part of their general description.

Examples

The example code below is Public Domain (CC0 1.0).

Callback

Download (example-callback.txt)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Change XYZ to the UID of your Servo Bricklet 2.0

setup:
    # Use position reached callback to swing back and forth
    subscribe to tinkerforge/callback/servo_v2_bricklet/XYZ/position_reached
        if a message arives
            # message contains the current servo_channel and position as int
            if position is 9000
                # Position is 90°, going to -90°
                publish '{"servo_channel": 0, "position": -9000}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_position
            elseif position is -9000
                # Position is -90°, going to 90°
                publish '{"servo_channel": 0, "position": 9000}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_position
            else
                # Another program has set the position, print an error
            endif
        endif
    endsubscribe

    publish '{"register": true}' to tinkerforge/register/servo_v2_bricklet/XYZ/position_reached # Register position_reached callback

    # Enable position reached callback
    publish '{"servo_channel": 0, "enabled": true}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_position_reached_callback_configuration

    # Set velocity to 100°/s. This has to be smaller or equal to the
    # maximum velocity of the servo you are using, otherwise the position
    # reached callback will be called too early
    publish '{"servo_channel": 0, "velocity": 10000, "acceleration": 500000, "deceleration": 500000}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_motion_configuration

    publish '{"servo_channel": 0, "position": 9000}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_position

    publish '{"servo_channel": 0, "enable": true}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_enable

cleanup:
    # If you are done, run this to clean up
    publish '{"servo_channel": 0, "enable": false}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_enable

Configuration

Download (example-configuration.txt)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Change XYZ to the UID of your Servo Bricklet 2.0

setup:
    # Servo 1: Connected to port 0, period of 19.5ms, pulse width of 1 to 2ms
    #          and operating angle -100 to 100°
    publish '{"servo_channel": 0, "min": -10000, "max": 10000}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_degree

    publish '{"servo_channel": 0, "min": 1000, "max": 2000}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_pulse_width

    publish '{"servo_channel": 0, "period": 19500}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_period

    publish '{"servo_channel": 0, "velocity": 500000, "acceleration": 1000, "deceleration": 1000}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_motion_configuration # Full velocity with slow ac-/deceleration

    # Servo 2: Connected to port 5, period of 20ms, pulse width of 0.95 to 1.95ms
    #          and operating angle -90 to 90°
    publish '{"servo_channel": 5, "min": -9000, "max": 9000}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_degree

    publish '{"servo_channel": 5, "min": 950, "max": 1950}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_pulse_width

    publish '{"servo_channel": 5, "period": 20000}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_period

    publish '{"servo_channel": 5, "velocity": 500000, "acceleration": 500000, "deceleration": 500000}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_motion_configuration # Full velocity with full ac-/deceleration

    publish '{"servo_channel": 0, "position": 10000}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_position # Set to most right position

    publish '{"servo_channel": 0, "enable": true}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_enable

    publish '{"servo_channel": 5, "position": -9000}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_position # Set to most left position

    publish '{"servo_channel": 5, "enable": true}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_enable

cleanup:
    # If you are done, run this to clean up
    publish '{"servo_channel": 0, "enable": false}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_enable

    publish '{"servo_channel": 5, "enable": false}' to tinkerforge/request/servo_v2_bricklet/XYZ/set_enable

API

All published payloads to and from the MQTT bindings are in JSON format.

If an error occures, the bindings publish a JSON object containing the error message as member _ERROR. It is published on the corresponding response topic: .../response/... for .../request/... and .../callback/... for .../register/....

Every function of the Servo Brick API that has a servo_channel parameter can address a servo with the servo channel (0 to 9). If it is a setter function then multiple servos can be addressed at once with a bitmask for the servos, if the highest bit is set. For example: 1 will address servo 1, (1 << 1) | (1 << 5) | (1 << 15) will address servos 1 and 5. This allows to set configurations to several servos with one function call. It is guaranteed that the changes will take effect in the same PWM period for all servos you specified in the bitmask.

Basic Functions

request/servo_v2_bricklet/<UID>/get_status
Request:
  • empty payload
Response:
  • enabled – Type: [bool, ...], Length: 10
  • current_position – Type: [int, ...], Length: 10, Unit: 1/100 °, Range: ?
  • current_velocity – Type: [int, ...], Length: 10, Unit: 1/100 °/s, Range: [0 to 500000]
  • current – Type: [int, ...], Length: 10, Unit: 1 mA, Range: [0 to 216 - 1]
  • input_voltage – Type: int, Unit: 1 mV, Range: [0 to 216 - 1]

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.

request/servo_v2_bricklet/<UID>/set_enable
Request:
  • servo_channel – Type: int, Range: [0 to 9, 215 to 33791]
  • enable – Type: bool, Default: false
Response:
  • no response

Enables a servo channel (0 to 9). If a servo is enabled, the configured position, velocity, acceleration, etc. are applied immediately.

request/servo_v2_bricklet/<UID>/get_enabled
Request:
  • servo_channel – Type: int, Range: [0 to 9]
Response:
  • enable – Type: bool, Default: false

Returns true if the specified servo channel is enabled, false otherwise.

request/servo_v2_bricklet/<UID>/set_position
Request:
  • servo_channel – Type: int, Range: [0 to 9, 215 to 33791]
  • position – Type: int, Unit: 1/100 °, Range: ?
Response:
  • no response

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 with request/servo_v2_bricklet/<UID>/set_degree.

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 with request/servo_v2_bricklet/<UID>/set_degree.

request/servo_v2_bricklet/<UID>/get_position
Request:
  • servo_channel – Type: int, Range: [0 to 9]
Response:
  • position – Type: int, Unit: 1/100 °, Range: ?

Returns the position of the specified servo channel as set by request/servo_v2_bricklet/<UID>/set_position.

request/servo_v2_bricklet/<UID>/get_current_position
Request:
  • servo_channel – Type: int, Range: [0 to 9]
Response:
  • position – Type: int, Unit: 1/100 °, Range: ?

Returns the current position of the specified servo channel. This may not be the value of request/servo_v2_bricklet/<UID>/set_position if the servo is currently approaching a position goal.

request/servo_v2_bricklet/<UID>/get_current_velocity
Request:
  • servo_channel – Type: int, Range: [0 to 9]
Response:
  • velocity – Type: int, Unit: 1/100 °/s, Range: [0 to 500000]

Returns the current velocity of the specified servo channel. This may not be the velocity specified by request/servo_v2_bricklet/<UID>/set_motion_configuration. if the servo is currently approaching a velocity goal.

request/servo_v2_bricklet/<UID>/set_motion_configuration
Request:
  • servo_channel – Type: int, Range: [0 to 9, 215 to 33791]
  • velocity – Type: int, Unit: 1/100 °/s, Range: [0 to 500000], Default: 100000
  • acceleration – Type: int, Unit: 1/100 °/s², Range: [0 to 500000], Default: 50000
  • deceleration – Type: int, Unit: 1/100 °/s², Range: [0 to 500000], Default: 50000
Response:
  • no response

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).

request/servo_v2_bricklet/<UID>/get_motion_configuration
Request:
  • servo_channel – Type: int, Range: [0 to 9]
Response:
  • velocity – Type: int, Unit: 1/100 °/s, Range: [0 to 500000], Default: 100000
  • acceleration – Type: int, Unit: 1/100 °/s², Range: [0 to 500000], Default: 50000
  • deceleration – Type: int, Unit: 1/100 °/s², Range: [0 to 500000], Default: 50000

Returns the motion configuration as set by request/servo_v2_bricklet/<UID>/set_motion_configuration.

request/servo_v2_bricklet/<UID>/set_pulse_width
Request:
  • servo_channel – Type: int, Range: [0 to 9, 215 to 33791]
  • min – Type: int, Unit: 1 µs, Range: [0 to 232 - 1], Default: 1000
  • max – Type: int, Unit: 1 µs, Range: [0 to 232 - 1], Default: 2000
Response:
  • no response

Sets the minimum and maximum pulse width of the specified servo channel in µs.

Usually, servos are controlled with a PWM, 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.

request/servo_v2_bricklet/<UID>/get_pulse_width
Request:
  • servo_channel – Type: int, Range: [0 to 9]
Response:
  • min – Type: int, Unit: 1 µs, Range: [0 to 232 - 1], Default: 1000
  • max – Type: int, Unit: 1 µs, Range: [0 to 232 - 1], Default: 2000

Returns the minimum and maximum pulse width for the specified servo channel as set by request/servo_v2_bricklet/<UID>/set_pulse_width.

request/servo_v2_bricklet/<UID>/set_degree
Request:
  • servo_channel – Type: int, Range: [0 to 9, 215 to 33791]
  • min – Type: int, Unit: 1/100 °, Range: [-215 to 215 - 1], Default: -9000
  • max – Type: int, Unit: 1/100 °, Range: [-215 to 215 - 1], Default: 9000
Response:
  • no response

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 of request/servo_v2_bricklet/<UID>/set_position 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 with request/servo_v2_bricklet/<UID>/set_position 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. request/servo_v2_bricklet/<UID>/set_position 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.

request/servo_v2_bricklet/<UID>/get_degree
Request:
  • servo_channel – Type: int, Range: [0 to 9]
Response:
  • min – Type: int, Unit: 1/100 °, Range: [-215 to 215 - 1], Default: -9000
  • max – Type: int, Unit: 1/100 °, Range: [-215 to 215 - 1], Default: 9000

Returns the minimum and maximum degree for the specified servo channel as set by request/servo_v2_bricklet/<UID>/set_degree.

request/servo_v2_bricklet/<UID>/set_period
Request:
  • servo_channel – Type: int, Range: [0 to 9, 215 to 33791]
  • period – Type: int, Unit: 1 µs, Range: [1 to 1000000], Default: 19500
Response:
  • no response

Sets the period of the specified servo channel in µs.

Usually, servos are controlled with a PWM. 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).

request/servo_v2_bricklet/<UID>/get_period
Request:
  • servo_channel – Type: int, Range: [0 to 9]
Response:
  • period – Type: int, Unit: 1 µs, Range: [1 to 1000000], Default: 19500

Returns the period for the specified servo channel as set by request/servo_v2_bricklet/<UID>/set_period.

request/servo_v2_bricklet/<UID>/get_servo_current
Request:
  • servo_channel – Type: int, Range: [0 to 9]
Response:
  • current – Type: int, Unit: 1 mA, Range: [0 to 216 - 1]

Returns the current consumption of the specified servo channel in mA.

request/servo_v2_bricklet/<UID>/set_servo_current_configuration
Request:
  • servo_channel – Type: int, Range: [0 to 9, 215 to 33791]
  • averaging_duration – Type: int, Unit: 1 ms, Range: [1 to 255], Default: 255
Response:
  • no response

Sets the averaging duration of the current measurement for the specified servo channel in ms.

request/servo_v2_bricklet/<UID>/get_servo_current_configuration
Request:
  • servo_channel – Type: int, Range: [0 to 9]
Response:
  • averaging_duration – Type: int, Unit: 1 ms, Range: [1 to 255], Default: 255

Returns the servo current configuration for the specified servo channel as set by request/servo_v2_bricklet/<UID>/set_servo_current_configuration.

request/servo_v2_bricklet/<UID>/set_input_voltage_configuration
Request:
  • averaging_duration – Type: int, Unit: 1 ms, Range: [1 to 255], Default: 255
Response:
  • no response

Sets the averaging duration of the input voltage measurement for the specified servo channel in ms.

request/servo_v2_bricklet/<UID>/get_input_voltage_configuration
Request:
  • empty payload
Response:
  • averaging_duration – Type: int, Unit: 1 ms, Range: [1 to 255], Default: 255

Returns the input voltage configuration as set by request/servo_v2_bricklet/<UID>/set_input_voltage_configuration.

request/servo_v2_bricklet/<UID>/get_overall_current
Request:
  • empty payload
Response:
  • current – Type: int, Unit: 1 mA, Range: [0 to 216 - 1]

Returns the current consumption of all servos together in mA.

request/servo_v2_bricklet/<UID>/get_input_voltage
Request:
  • empty payload
Response:
  • voltage – Type: int, Unit: 1 mV, Range: [0 to 216 - 1]

Returns the input voltage in mV. The input voltage is given via the black power input connector on the Servo Brick.

Advanced Functions

request/servo_v2_bricklet/<UID>/set_current_calibration
Request:
  • offset – Type: [int, ...], Length: 10, Unit: 1 mA, Range: [-215 to 215 - 1]
Response:
  • no response

Sets an offset value (in mA) for each channel.

Note: On delivery the Servo Bricklet 2.0 is already calibrated.

request/servo_v2_bricklet/<UID>/get_current_calibration
Request:
  • empty payload
Response:
  • offset – Type: [int, ...], Length: 10, Unit: 1 mA, Range: [-215 to 215 - 1]

Returns the current calibration as set by request/servo_v2_bricklet/<UID>/set_current_calibration.

request/servo_v2_bricklet/<UID>/get_spitfp_error_count
Request:
  • empty payload
Response:
  • error_count_ack_checksum – Type: int, Range: [0 to 232 - 1]
  • error_count_message_checksum – Type: int, Range: [0 to 232 - 1]
  • error_count_frame – Type: int, Range: [0 to 232 - 1]
  • error_count_overflow – Type: int, Range: [0 to 232 - 1]

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.

request/servo_v2_bricklet/<UID>/set_status_led_config
Request:
  • config – Type: int, Range: See symbols, Default: 3
Response:
  • no response

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.

The following symbols are available for this function:

For config:

  • "off" = 0
  • "on" = 1
  • "show_heartbeat" = 2
  • "show_status" = 3
request/servo_v2_bricklet/<UID>/get_status_led_config
Request:
  • empty payload
Response:
  • config – Type: int, Range: See symbols, Default: 3

Returns the configuration as set by request/servo_v2_bricklet/<UID>/set_status_led_config

The following symbols are available for this function:

For config:

  • "off" = 0
  • "on" = 1
  • "show_heartbeat" = 2
  • "show_status" = 3
request/servo_v2_bricklet/<UID>/get_chip_temperature
Request:
  • empty payload
Response:
  • temperature – Type: int, Unit: 1 °C, Range: [-215 to 215 - 1]

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.

request/servo_v2_bricklet/<UID>/reset
Request:
  • empty payload
Response:
  • no response

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!

request/servo_v2_bricklet/<UID>/get_identity
Request:
  • empty payload
Response:
  • uid – Type: string, Length: up to 8
  • connected_uid – Type: string, Length: up to 8
  • position – Type: char, Range: ["a" to "h", "z"]
  • hardware_version – Type: [int, ...], Length: 3
    • 0: major – Type: int, Range: [0 to 255]
    • 1: minor – Type: int, Range: [0 to 255]
    • 2: revision – Type: int, Range: [0 to 255]
  • firmware_version – Type: [int, ...], Length: 3
    • 0: major – Type: int, Range: [0 to 255]
    • 1: minor – Type: int, Range: [0 to 255]
    • 2: revision – Type: int, Range: [0 to 255]
  • device_identifier – Type: int, Range: [0 to 216 - 1]
  • _display_name – Type: string

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 Isolator Bricklet is always at position 'z'.

The device identifier numbers can be found here. If symbolic output is not disabled, the device identifier is mapped to the corresponding name in the format used in topics.

The display name contains the Servo 2.0's name in a human readable form.

Callback Configuration Functions

request/servo_v2_bricklet/<UID>/set_position_reached_callback_configuration
Request:
  • servo_channel – Type: int, Range: [0 to 9, 215 to 33791]
  • enabled – Type: bool, Default: false
Response:
  • no response

Enable/Disable register/servo_v2_bricklet/<UID>/position_reached callback.

request/servo_v2_bricklet/<UID>/get_position_reached_callback_configuration
Request:
  • servo_channel – Type: int, Range: [0 to 9]
Response:
  • enabled – Type: bool, Default: false

Returns the callback configuration as set by request/servo_v2_bricklet/<UID>/set_position_reached_callback_configuration.

Callbacks

Callbacks can be registered to receive time critical or recurring data from the device. The registration is done with the corresponding .../register/... topic and an optional suffix. This suffix can be used to deregister the callback later.

Note

Using callbacks for recurring events is always preferred compared to using getters. It will use less USB bandwidth and the latency will be a lot better, since there is no round trip time.

register/servo_v2_bricklet/<UID>/position_reached
Register Request:
  • register – Type: bool
Callback Response:
  • servo_channel – Type: int, Range: [0 to 9]
  • position – Type: int, Unit: 1/100 °, Range: ?

A callback can be registered for this event by publishing to the .../register/servo_v2_bricklet/<UID>/position_reached[/<SUFFIX>] topic with the payload "true". An added callback can be removed by publishing to the same topic with the payload "false". To support multiple (de)registrations, e.g. for message filtering, an optional suffix can be used.

If the callback is triggered, a message with it's payload is published under the corresponding .../callback/servo_v2_bricklet/<UID>/position_reached[/<SUFFIX>] topic for each registered suffix.

This callback is triggered when a position set by request/servo_v2_bricklet/<UID>/set_position is reached. If the new position matches the current position then the callback is not triggered, because the servo didn't move. The callback payload members are the servo and the position that is reached.

You can enable this callback with request/servo_v2_bricklet/<UID>/set_position_reached_callback_configuration.

Note

Since we can't get any feedback from the servo, this only works if the velocity (see request/servo_v2_bricklet/<UID>/set_motion_configuration) is set smaller or equal to the maximum velocity of the servo. Otherwise the servo will lag behind the control value and the callback will be triggered too early.

Internal Functions

Internal functions are used for maintenance tasks such as flashing a new firmware of changing the UID of a Bricklet. These task should be performed using Brick Viewer instead of using the internal functions directly.

request/servo_v2_bricklet/<UID>/set_bootloader_mode
Request:
  • mode – Type: int, Range: See symbols
Response:
  • status – Type: int, Range: See symbols

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.

The following symbols are available for this function:

For mode:

  • "bootloader" = 0
  • "firmware" = 1
  • "bootloader_wait_for_reboot" = 2
  • "firmware_wait_for_reboot" = 3
  • "firmware_wait_for_erase_and_reboot" = 4

For status:

  • "ok" = 0
  • "invalid_mode" = 1
  • "no_change" = 2
  • "entry_function_not_present" = 3
  • "device_identifier_incorrect" = 4
  • "crc_mismatch" = 5
request/servo_v2_bricklet/<UID>/get_bootloader_mode
Request:
  • empty payload
Response:
  • mode – Type: int, Range: See symbols

Returns the current bootloader mode, see request/servo_v2_bricklet/<UID>/set_bootloader_mode.

The following symbols are available for this function:

For mode:

  • "bootloader" = 0
  • "firmware" = 1
  • "bootloader_wait_for_reboot" = 2
  • "firmware_wait_for_reboot" = 3
  • "firmware_wait_for_erase_and_reboot" = 4
request/servo_v2_bricklet/<UID>/set_write_firmware_pointer
Request:
  • pointer – Type: int, Unit: 1 B, Range: [0 to 232 - 1]
Response:
  • no response

Sets the firmware pointer for request/servo_v2_bricklet/<UID>/write_firmware. 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.

request/servo_v2_bricklet/<UID>/write_firmware
Request:
  • data – Type: [int, ...], Length: 64, Range: [0 to 255]
Response:
  • status – Type: int, Range: [0 to 255]

Writes 64 Bytes of firmware at the position as written by request/servo_v2_bricklet/<UID>/set_write_firmware_pointer 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.

request/servo_v2_bricklet/<UID>/write_uid
Request:
  • uid – Type: int, Range: [0 to 232 - 1]
Response:
  • no response

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.

request/servo_v2_bricklet/<UID>/read_uid
Request:
  • empty payload
Response:
  • uid – Type: int, Range: [0 to 232 - 1]

Returns the current UID as an integer. Encode as Base58 to get the usual string version.