tinkerforge 2.1.11 → 2.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/tinkerforge/brick_dc.rb +31 -9
- data/lib/tinkerforge/brick_imu.rb +62 -40
- data/lib/tinkerforge/brick_imu_v2.rb +70 -42
- data/lib/tinkerforge/brick_master.rb +47 -23
- data/lib/tinkerforge/brick_red.rb +3 -3
- data/lib/tinkerforge/brick_servo.rb +40 -18
- data/lib/tinkerforge/brick_silent_stepper.rb +829 -0
- data/lib/tinkerforge/brick_stepper.rb +47 -25
- data/lib/tinkerforge/bricklet_accelerometer.rb +11 -11
- data/lib/tinkerforge/bricklet_ambient_light.rb +12 -12
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +8 -8
- data/lib/tinkerforge/bricklet_analog_in.rb +18 -18
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +15 -15
- data/lib/tinkerforge/bricklet_analog_out.rb +3 -3
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +3 -3
- data/lib/tinkerforge/bricklet_barometer.rb +19 -19
- data/lib/tinkerforge/bricklet_can.rb +20 -7
- data/lib/tinkerforge/bricklet_co2.rb +14 -14
- data/lib/tinkerforge/bricklet_color.rb +19 -19
- data/lib/tinkerforge/bricklet_current12.rb +16 -16
- data/lib/tinkerforge/bricklet_current25.rb +15 -15
- data/lib/tinkerforge/bricklet_distance_ir.rb +14 -14
- data/lib/tinkerforge/bricklet_distance_us.rb +9 -9
- data/lib/tinkerforge/bricklet_dual_button.rb +5 -5
- data/lib/tinkerforge/bricklet_dual_relay.rb +13 -13
- data/lib/tinkerforge/bricklet_dust_detector.rb +11 -11
- data/lib/tinkerforge/bricklet_gps.rb +21 -21
- data/lib/tinkerforge/bricklet_hall_effect.rb +12 -10
- data/lib/tinkerforge/bricklet_humidity.rb +21 -21
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +3 -3
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +4 -4
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +4 -4
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +6 -6
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +6 -6
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +5 -5
- data/lib/tinkerforge/bricklet_io16.rb +5 -5
- data/lib/tinkerforge/bricklet_io4.rb +5 -5
- data/lib/tinkerforge/bricklet_joystick.rb +16 -16
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +99 -30
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +5 -5
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +5 -5
- data/lib/tinkerforge/bricklet_led_strip.rb +3 -3
- data/lib/tinkerforge/bricklet_line.rb +12 -12
- data/lib/tinkerforge/bricklet_linear_poti.rb +21 -21
- data/lib/tinkerforge/bricklet_load_cell.rb +10 -10
- data/lib/tinkerforge/bricklet_moisture.rb +12 -12
- data/lib/tinkerforge/bricklet_motion_detector.rb +5 -5
- data/lib/tinkerforge/bricklet_multi_touch.rb +3 -3
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +20 -20
- data/lib/tinkerforge/bricklet_oled_128x64.rb +7 -7
- data/lib/tinkerforge/bricklet_oled_64x48.rb +6 -6
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +4 -4
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +5 -5
- data/lib/tinkerforge/bricklet_ptc.rb +21 -21
- data/lib/tinkerforge/bricklet_real_time_clock.rb +7 -7
- data/lib/tinkerforge/bricklet_remote_switch.rb +3 -3
- data/lib/tinkerforge/bricklet_rgb_led.rb +3 -3
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +6 -6
- data/lib/tinkerforge/bricklet_rotary_poti.rb +23 -23
- data/lib/tinkerforge/bricklet_rs232.rb +19 -16
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +5 -5
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +12 -12
- data/lib/tinkerforge/bricklet_sound_intensity.rb +13 -12
- data/lib/tinkerforge/bricklet_temperature.rb +12 -12
- data/lib/tinkerforge/bricklet_temperature_ir.rb +30 -30
- data/lib/tinkerforge/bricklet_thermocouple.rb +13 -13
- data/lib/tinkerforge/bricklet_tilt.rb +3 -3
- data/lib/tinkerforge/bricklet_uv_light.rb +10 -10
- data/lib/tinkerforge/bricklet_voltage.rb +18 -18
- data/lib/tinkerforge/bricklet_voltage_current.rb +23 -23
- data/lib/tinkerforge/version.rb +1 -1
- metadata +3 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2017-
|
|
3
|
+
# This file was automatically generated on 2017-04-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.12 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
@@ -19,7 +19,7 @@ module Tinkerforge
|
|
|
19
19
|
# BrickletIndustrialDualAnalogIn#set_voltage_callback_period. The parameter is the voltage of the
|
|
20
20
|
# channel.
|
|
21
21
|
#
|
|
22
|
-
# CALLBACK_VOLTAGE is only triggered if the voltage has changed since the
|
|
22
|
+
# The CALLBACK_VOLTAGE callback is only triggered if the voltage has changed since the
|
|
23
23
|
# last triggering.
|
|
24
24
|
CALLBACK_VOLTAGE = 13
|
|
25
25
|
|
|
@@ -89,7 +89,7 @@ module Tinkerforge
|
|
|
89
89
|
# Returns the voltage for the given channel in mV.
|
|
90
90
|
#
|
|
91
91
|
# If you want to get the voltage periodically, it is recommended to use the
|
|
92
|
-
# callback
|
|
92
|
+
# CALLBACK_VOLTAGE callback and set the period with
|
|
93
93
|
# BrickletIndustrialDualAnalogIn#set_voltage_callback_period.
|
|
94
94
|
def get_voltage(channel)
|
|
95
95
|
send_request(FUNCTION_GET_VOLTAGE, [channel], 'C', 4, 'l')
|
|
@@ -98,7 +98,7 @@ module Tinkerforge
|
|
|
98
98
|
# Sets the period in ms with which the CALLBACK_VOLTAGE callback is triggered
|
|
99
99
|
# periodically for the given channel. A value of 0 turns the callback off.
|
|
100
100
|
#
|
|
101
|
-
# CALLBACK_VOLTAGE is only triggered if the voltage has changed since the
|
|
101
|
+
# The CALLBACK_VOLTAGE callback is only triggered if the voltage has changed since the
|
|
102
102
|
# last triggering.
|
|
103
103
|
#
|
|
104
104
|
# The default value is 0.
|
|
@@ -188,7 +188,7 @@ module Tinkerforge
|
|
|
188
188
|
send_request(FUNCTION_GET_ADC_VALUES, [], '', 8, 'l2')
|
|
189
189
|
end
|
|
190
190
|
|
|
191
|
-
# Returns the UID, the UID where the Bricklet is connected to,
|
|
191
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
|
192
192
|
# the position, the hardware and firmware version as well as the
|
|
193
193
|
# device identifier.
|
|
194
194
|
#
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2017-
|
|
3
|
+
# This file was automatically generated on 2017-04-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.12 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
@@ -135,8 +135,8 @@ module Tinkerforge
|
|
|
135
135
|
send_request(FUNCTION_GET_AVAILABLE_FOR_GROUP, [], '', 1, 'C')
|
|
136
136
|
end
|
|
137
137
|
|
|
138
|
-
# Sets the output value with a bitmask, according to the selection mask.
|
|
139
|
-
# The bitmask is 16 bit long, *true* refers to a closed relay and
|
|
138
|
+
# Sets the output value with a bitmask, according to the selection mask.
|
|
139
|
+
# The bitmask is 16 bit long, *true* refers to a closed relay and
|
|
140
140
|
# *false* refers to an open relay.
|
|
141
141
|
#
|
|
142
142
|
# For example: The values (3, 1) or (0b0011, 0b0001) will close the relay of
|
|
@@ -152,7 +152,7 @@ module Tinkerforge
|
|
|
152
152
|
send_request(FUNCTION_SET_SELECTED_VALUES, [selection_mask, value_mask], 'S S', 0, '')
|
|
153
153
|
end
|
|
154
154
|
|
|
155
|
-
# Returns the UID, the UID where the Bricklet is connected to,
|
|
155
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
|
156
156
|
# the position, the hardware and firmware version as well as the
|
|
157
157
|
# device identifier.
|
|
158
158
|
#
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2017-
|
|
3
|
+
# This file was automatically generated on 2017-04-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.12 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
@@ -164,7 +164,7 @@ module Tinkerforge
|
|
|
164
164
|
# For example: ('a', 129) or ('a', 0b10000001) will enable the interrupt for
|
|
165
165
|
# pins 0 and 7 of port a.
|
|
166
166
|
#
|
|
167
|
-
# The interrupt is delivered with the callback
|
|
167
|
+
# The interrupt is delivered with the CALLBACK_INTERRUPT callback.
|
|
168
168
|
def set_port_interrupt(port, interrupt_mask)
|
|
169
169
|
send_request(FUNCTION_SET_PORT_INTERRUPT, [port, interrupt_mask], 'k C', 0, '')
|
|
170
170
|
end
|
|
@@ -207,7 +207,7 @@ module Tinkerforge
|
|
|
207
207
|
send_request(FUNCTION_GET_PORT_MONOFLOP, [port, pin], 'k C', 9, 'C L L')
|
|
208
208
|
end
|
|
209
209
|
|
|
210
|
-
# Sets the output value (high or low) for a port ("a" or "b" with a bitmask,
|
|
210
|
+
# Sets the output value (high or low) for a port ("a" or "b" with a bitmask,
|
|
211
211
|
# according to the selection mask. The bitmask is 8 bit long and a 1 in the
|
|
212
212
|
# bitmask means high and a 0 in the bitmask means low.
|
|
213
213
|
#
|
|
@@ -264,7 +264,7 @@ module Tinkerforge
|
|
|
264
264
|
send_request(FUNCTION_GET_EDGE_COUNT_CONFIG, [pin], 'C', 2, 'C C')
|
|
265
265
|
end
|
|
266
266
|
|
|
267
|
-
# Returns the UID, the UID where the Bricklet is connected to,
|
|
267
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
|
268
268
|
# the position, the hardware and firmware version as well as the
|
|
269
269
|
# device identifier.
|
|
270
270
|
#
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2017-
|
|
3
|
+
# This file was automatically generated on 2017-04-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.12 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
@@ -163,7 +163,7 @@ module Tinkerforge
|
|
|
163
163
|
# For example: An interrupt bitmask of 10 or 0b1010 will enable the interrupt for
|
|
164
164
|
# pins 1 and 3.
|
|
165
165
|
#
|
|
166
|
-
# The interrupt is delivered with the callback
|
|
166
|
+
# The interrupt is delivered with the CALLBACK_INTERRUPT callback.
|
|
167
167
|
def set_interrupt(interrupt_mask)
|
|
168
168
|
send_request(FUNCTION_SET_INTERRUPT, [interrupt_mask], 'C', 0, '')
|
|
169
169
|
end
|
|
@@ -206,7 +206,7 @@ module Tinkerforge
|
|
|
206
206
|
end
|
|
207
207
|
|
|
208
208
|
# Sets the output value (high or low) with a bitmask, according to
|
|
209
|
-
# the selection mask. The bitmask is 4 bit long, *true* refers to high
|
|
209
|
+
# the selection mask. The bitmask is 4 bit long, *true* refers to high
|
|
210
210
|
# and *false* refers to low.
|
|
211
211
|
#
|
|
212
212
|
# For example: The parameters (9, 4) or (0b0110, 0b0100) will turn
|
|
@@ -261,7 +261,7 @@ module Tinkerforge
|
|
|
261
261
|
send_request(FUNCTION_GET_EDGE_COUNT_CONFIG, [pin], 'C', 2, 'C C')
|
|
262
262
|
end
|
|
263
263
|
|
|
264
|
-
# Returns the UID, the UID where the Bricklet is connected to,
|
|
264
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
|
265
265
|
# the position, the hardware and firmware version as well as the
|
|
266
266
|
# device identifier.
|
|
267
267
|
#
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2017-
|
|
3
|
+
# This file was automatically generated on 2017-04-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.12 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
@@ -19,16 +19,16 @@ module Tinkerforge
|
|
|
19
19
|
# BrickletJoystick#set_position_callback_period. The parameter is the position of the
|
|
20
20
|
# Joystick.
|
|
21
21
|
#
|
|
22
|
-
# CALLBACK_POSITION is only triggered if the position has changed since the
|
|
22
|
+
# The CALLBACK_POSITION callback is only triggered if the position has changed since the
|
|
23
23
|
# last triggering.
|
|
24
24
|
CALLBACK_POSITION = 15
|
|
25
25
|
|
|
26
26
|
# This callback is triggered periodically with the period that is set by
|
|
27
|
-
# BrickletJoystick#set_analog_value_callback_period. The parameters are the
|
|
28
|
-
# of the Joystick.
|
|
27
|
+
# BrickletJoystick#set_analog_value_callback_period. The parameters are the
|
|
28
|
+
# analog values of the Joystick.
|
|
29
29
|
#
|
|
30
|
-
# CALLBACK_ANALOG_VALUE is only triggered if the values have changed
|
|
31
|
-
# last triggering.
|
|
30
|
+
# The CALLBACK_ANALOG_VALUE callback is only triggered if the values have changed
|
|
31
|
+
# since the last triggering.
|
|
32
32
|
CALLBACK_ANALOG_VALUE = 16
|
|
33
33
|
|
|
34
34
|
# This callback is triggered when the threshold as set by
|
|
@@ -117,7 +117,7 @@ module Tinkerforge
|
|
|
117
117
|
# returned values are averaged and calibrated (see BrickletJoystick#calibrate).
|
|
118
118
|
#
|
|
119
119
|
# If you want to get the position periodically, it is recommended to use the
|
|
120
|
-
# callback
|
|
120
|
+
# CALLBACK_POSITION callback and set the period with
|
|
121
121
|
# BrickletJoystick#set_position_callback_period.
|
|
122
122
|
def get_position
|
|
123
123
|
send_request(FUNCTION_GET_POSITION, [], '', 4, 's s')
|
|
@@ -140,8 +140,8 @@ module Tinkerforge
|
|
|
140
140
|
# unfiltered analog values. The only reason to use BrickletJoystick#get_analog_value is,
|
|
141
141
|
# if you need the full resolution of the analog-to-digital converter.
|
|
142
142
|
#
|
|
143
|
-
# If you want the analog values periodically, it is recommended to use the
|
|
144
|
-
# callback
|
|
143
|
+
# If you want the analog values periodically, it is recommended to use the
|
|
144
|
+
# CALLBACK_ANALOG_VALUE callback and set the period with
|
|
145
145
|
# BrickletJoystick#set_analog_value_callback_period.
|
|
146
146
|
def get_analog_value
|
|
147
147
|
send_request(FUNCTION_GET_ANALOG_VALUE, [], '', 4, 'S S')
|
|
@@ -160,7 +160,7 @@ module Tinkerforge
|
|
|
160
160
|
# Sets the period in ms with which the CALLBACK_POSITION callback is triggered
|
|
161
161
|
# periodically. A value of 0 turns the callback off.
|
|
162
162
|
#
|
|
163
|
-
# CALLBACK_POSITION is only triggered if the position has changed since the
|
|
163
|
+
# The CALLBACK_POSITION callback is only triggered if the position has changed since the
|
|
164
164
|
# last triggering.
|
|
165
165
|
#
|
|
166
166
|
# The default value is 0.
|
|
@@ -176,8 +176,8 @@ module Tinkerforge
|
|
|
176
176
|
# Sets the period in ms with which the CALLBACK_ANALOG_VALUE callback is triggered
|
|
177
177
|
# periodically. A value of 0 turns the callback off.
|
|
178
178
|
#
|
|
179
|
-
# CALLBACK_ANALOG_VALUE is only triggered if the analog values have
|
|
180
|
-
# last triggering.
|
|
179
|
+
# The CALLBACK_ANALOG_VALUE callback is only triggered if the analog values have
|
|
180
|
+
# changed since the last triggering.
|
|
181
181
|
#
|
|
182
182
|
# The default value is 0.
|
|
183
183
|
def set_analog_value_callback_period(period)
|
|
@@ -189,7 +189,7 @@ module Tinkerforge
|
|
|
189
189
|
send_request(FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L')
|
|
190
190
|
end
|
|
191
191
|
|
|
192
|
-
# Sets the thresholds for the CALLBACK_POSITION_REACHED callback.
|
|
192
|
+
# Sets the thresholds for the CALLBACK_POSITION_REACHED callback.
|
|
193
193
|
#
|
|
194
194
|
# The following options are possible:
|
|
195
195
|
#
|
|
@@ -211,7 +211,7 @@ module Tinkerforge
|
|
|
211
211
|
send_request(FUNCTION_GET_POSITION_CALLBACK_THRESHOLD, [], '', 9, 'k s s s s')
|
|
212
212
|
end
|
|
213
213
|
|
|
214
|
-
# Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
|
|
214
|
+
# Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
|
|
215
215
|
#
|
|
216
216
|
# The following options are possible:
|
|
217
217
|
#
|
|
@@ -255,7 +255,7 @@ module Tinkerforge
|
|
|
255
255
|
send_request(FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L')
|
|
256
256
|
end
|
|
257
257
|
|
|
258
|
-
# Returns the UID, the UID where the Bricklet is connected to,
|
|
258
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
|
259
259
|
# the position, the hardware and firmware version as well as the
|
|
260
260
|
# device identifier.
|
|
261
261
|
#
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2017-
|
|
3
|
+
# This file was automatically generated on 2017-04-21. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.12 #
|
|
6
6
|
# #
|
|
7
7
|
# If you have a bugfix for this file and want to commit it, #
|
|
8
8
|
# please fix the bug in the generator. You can find a link #
|
|
@@ -16,19 +16,19 @@ module Tinkerforge
|
|
|
16
16
|
DEVICE_DISPLAY_NAME = 'Laser Range Finder Bricklet' # :nodoc:
|
|
17
17
|
|
|
18
18
|
# This callback is triggered periodically with the period that is set by
|
|
19
|
-
# BrickletLaserRangeFinder#set_distance_callback_period. The parameter is the distance
|
|
20
|
-
# of the sensor.
|
|
19
|
+
# BrickletLaserRangeFinder#set_distance_callback_period. The parameter is the distance
|
|
20
|
+
# value of the sensor.
|
|
21
21
|
#
|
|
22
|
-
# CALLBACK_DISTANCE is only triggered if the distance value has changed
|
|
23
|
-
# last triggering.
|
|
22
|
+
# The CALLBACK_DISTANCE callback is only triggered if the distance value has changed
|
|
23
|
+
# since the last triggering.
|
|
24
24
|
CALLBACK_DISTANCE = 20
|
|
25
25
|
|
|
26
26
|
# This callback is triggered periodically with the period that is set by
|
|
27
|
-
# BrickletLaserRangeFinder#set_velocity_callback_period. The parameter is the velocity
|
|
28
|
-
# of the sensor.
|
|
27
|
+
# BrickletLaserRangeFinder#set_velocity_callback_period. The parameter is the velocity
|
|
28
|
+
# value of the sensor.
|
|
29
29
|
#
|
|
30
|
-
# CALLBACK_VELOCITY is only triggered if the velocity has changed since
|
|
31
|
-
# last triggering.
|
|
30
|
+
# The CALLBACK_VELOCITY callback is only triggered if the velocity has changed since
|
|
31
|
+
# the last triggering.
|
|
32
32
|
CALLBACK_VELOCITY = 21
|
|
33
33
|
|
|
34
34
|
# This callback is triggered when the threshold as set by
|
|
@@ -66,6 +66,9 @@ module Tinkerforge
|
|
|
66
66
|
FUNCTION_ENABLE_LASER = 17 # :nodoc:
|
|
67
67
|
FUNCTION_DISABLE_LASER = 18 # :nodoc:
|
|
68
68
|
FUNCTION_IS_LASER_ENABLED = 19 # :nodoc:
|
|
69
|
+
FUNCTION_GET_SENSOR_HARDWARE_VERSION = 24 # :nodoc:
|
|
70
|
+
FUNCTION_SET_CONFIGURATION = 25 # :nodoc:
|
|
71
|
+
FUNCTION_GET_CONFIGURATION = 26 # :nodoc:
|
|
69
72
|
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
|
70
73
|
|
|
71
74
|
THRESHOLD_OPTION_OFF = 'x' # :nodoc:
|
|
@@ -78,13 +81,15 @@ module Tinkerforge
|
|
|
78
81
|
MODE_VELOCITY_MAX_32MS = 2 # :nodoc:
|
|
79
82
|
MODE_VELOCITY_MAX_64MS = 3 # :nodoc:
|
|
80
83
|
MODE_VELOCITY_MAX_127MS = 4 # :nodoc:
|
|
84
|
+
VERSION_1 = 1 # :nodoc:
|
|
85
|
+
VERSION_3 = 3 # :nodoc:
|
|
81
86
|
|
|
82
87
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
83
88
|
# the IP Connection <tt>ipcon</tt>.
|
|
84
89
|
def initialize(uid, ipcon)
|
|
85
90
|
super uid, ipcon
|
|
86
91
|
|
|
87
|
-
@api_version = [2, 0,
|
|
92
|
+
@api_version = [2, 0, 1]
|
|
88
93
|
|
|
89
94
|
@response_expected[FUNCTION_GET_DISTANCE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
90
95
|
@response_expected[FUNCTION_GET_VELOCITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
@@ -109,6 +114,9 @@ module Tinkerforge
|
|
|
109
114
|
@response_expected[CALLBACK_VELOCITY] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
110
115
|
@response_expected[CALLBACK_DISTANCE_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
111
116
|
@response_expected[CALLBACK_VELOCITY_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
117
|
+
@response_expected[FUNCTION_GET_SENSOR_HARDWARE_VERSION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
118
|
+
@response_expected[FUNCTION_SET_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
|
|
119
|
+
@response_expected[FUNCTION_GET_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
112
120
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
113
121
|
|
|
114
122
|
@callback_formats[CALLBACK_DISTANCE] = 'S'
|
|
@@ -120,13 +128,14 @@ module Tinkerforge
|
|
|
120
128
|
# Returns the measured distance. The value has a range of 0 to 4000
|
|
121
129
|
# and is given in cm.
|
|
122
130
|
#
|
|
123
|
-
#
|
|
124
|
-
#
|
|
125
|
-
#
|
|
126
|
-
#
|
|
131
|
+
# Sensor hardware version 1 (see BrickletLaserRangeFinder#get_sensor_hardware_version) cannot
|
|
132
|
+
# measure distance and velocity at the same time. Therefore, the distance mode
|
|
133
|
+
# has to be enabled using BrickletLaserRangeFinder#set_mode.
|
|
134
|
+
# Sensor hardware version 3 can measure distance and velocity at the same
|
|
135
|
+
# time. Also the laser has to be enabled, see BrickletLaserRangeFinder#enable_laser.
|
|
127
136
|
#
|
|
128
137
|
# If you want to get the distance periodically, it is recommended to
|
|
129
|
-
# use the callback
|
|
138
|
+
# use the CALLBACK_DISTANCE callback and set the period with
|
|
130
139
|
# BrickletLaserRangeFinder#set_distance_callback_period.
|
|
131
140
|
def get_distance
|
|
132
141
|
send_request(FUNCTION_GET_DISTANCE, [], '', 2, 'S')
|
|
@@ -135,13 +144,16 @@ module Tinkerforge
|
|
|
135
144
|
# Returns the measured velocity. The value has a range of -12800 to 12700
|
|
136
145
|
# and is given in 1/100 m/s.
|
|
137
146
|
#
|
|
138
|
-
#
|
|
139
|
-
#
|
|
140
|
-
#
|
|
141
|
-
#
|
|
147
|
+
# Sensor hardware version 1 (see BrickletLaserRangeFinder#get_sensor_hardware_version) cannot
|
|
148
|
+
# measure distance and velocity at the same time. Therefore, the velocity mode
|
|
149
|
+
# has to be enabled using BrickletLaserRangeFinder#set_mode.
|
|
150
|
+
# Sensor hardware version 3 can measure distance and velocity at the same
|
|
151
|
+
# time, but the velocity measurement only produces stables results if a fixed
|
|
152
|
+
# measurement rate (see BrickletLaserRangeFinder#set_configuration) is configured. Also the laser
|
|
153
|
+
# has to be enabled, see BrickletLaserRangeFinder#enable_laser.
|
|
142
154
|
#
|
|
143
155
|
# If you want to get the velocity periodically, it is recommended to
|
|
144
|
-
# use the callback
|
|
156
|
+
# use the CALLBACK_VELOCITY callback and set the period with
|
|
145
157
|
# BrickletLaserRangeFinder#set_velocity_callback_period.
|
|
146
158
|
def get_velocity
|
|
147
159
|
send_request(FUNCTION_GET_VELOCITY, [], '', 2, 's')
|
|
@@ -150,8 +162,8 @@ module Tinkerforge
|
|
|
150
162
|
# Sets the period in ms with which the CALLBACK_DISTANCE callback is triggered
|
|
151
163
|
# periodically. A value of 0 turns the callback off.
|
|
152
164
|
#
|
|
153
|
-
# CALLBACK_DISTANCE is only triggered if the distance value has
|
|
154
|
-
# last triggering.
|
|
165
|
+
# The CALLBACK_DISTANCE callback is only triggered if the distance value has
|
|
166
|
+
# changed since the last triggering.
|
|
155
167
|
#
|
|
156
168
|
# The default value is 0.
|
|
157
169
|
def set_distance_callback_period(period)
|
|
@@ -166,8 +178,8 @@ module Tinkerforge
|
|
|
166
178
|
# Sets the period in ms with which the CALLBACK_VELOCITY callback is triggered
|
|
167
179
|
# periodically. A value of 0 turns the callback off.
|
|
168
180
|
#
|
|
169
|
-
# CALLBACK_VELOCITY is only triggered if the velocity value has
|
|
170
|
-
# last triggering.
|
|
181
|
+
# The CALLBACK_VELOCITY callback is only triggered if the velocity value has
|
|
182
|
+
# changed since the last triggering.
|
|
171
183
|
#
|
|
172
184
|
# The default value is 0.
|
|
173
185
|
def set_velocity_callback_period(period)
|
|
@@ -179,7 +191,7 @@ module Tinkerforge
|
|
|
179
191
|
send_request(FUNCTION_GET_VELOCITY_CALLBACK_PERIOD, [], '', 4, 'L')
|
|
180
192
|
end
|
|
181
193
|
|
|
182
|
-
# Sets the thresholds for the CALLBACK_DISTANCE_REACHED callback.
|
|
194
|
+
# Sets the thresholds for the CALLBACK_DISTANCE_REACHED callback.
|
|
183
195
|
#
|
|
184
196
|
# The following options are possible:
|
|
185
197
|
#
|
|
@@ -201,7 +213,7 @@ module Tinkerforge
|
|
|
201
213
|
send_request(FUNCTION_GET_DISTANCE_CALLBACK_THRESHOLD, [], '', 5, 'k S S')
|
|
202
214
|
end
|
|
203
215
|
|
|
204
|
-
# Sets the thresholds for the CALLBACK_VELOCITY_REACHED callback.
|
|
216
|
+
# Sets the thresholds for the CALLBACK_VELOCITY_REACHED callback.
|
|
205
217
|
#
|
|
206
218
|
# The following options are possible:
|
|
207
219
|
#
|
|
@@ -263,8 +275,13 @@ module Tinkerforge
|
|
|
263
275
|
send_request(FUNCTION_GET_MOVING_AVERAGE, [], '', 2, 'C C')
|
|
264
276
|
end
|
|
265
277
|
|
|
266
|
-
#
|
|
267
|
-
#
|
|
278
|
+
# .. note::
|
|
279
|
+
# This function is only available if you have a LIDAR-Lite sensor with hardware
|
|
280
|
+
# version 1. Use BrickletLaserRangeFinder#set_configuration for hardware version 3. You can check
|
|
281
|
+
# the sensor hardware version using BrickletLaserRangeFinder#get_sensor_hardware_version.
|
|
282
|
+
#
|
|
283
|
+
# The LIDAR-Lite sensor (hardware version 1) has five different modes. One mode is
|
|
284
|
+
# for distance measurements and four modes are for velocity measurements with
|
|
268
285
|
# different ranges.
|
|
269
286
|
#
|
|
270
287
|
# The following modes are available:
|
|
@@ -303,7 +320,59 @@ module Tinkerforge
|
|
|
303
320
|
send_request(FUNCTION_IS_LASER_ENABLED, [], '', 1, '?')
|
|
304
321
|
end
|
|
305
322
|
|
|
306
|
-
# Returns the
|
|
323
|
+
# Returns the LIDAR-Lite hardware version.
|
|
324
|
+
#
|
|
325
|
+
# .. versionadded:: 2.0.3$nbsp;(Plugin)
|
|
326
|
+
def get_sensor_hardware_version
|
|
327
|
+
send_request(FUNCTION_GET_SENSOR_HARDWARE_VERSION, [], '', 1, 'C')
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
# .. note::
|
|
331
|
+
# This function is only available if you have a LIDAR-Lite sensor with hardware
|
|
332
|
+
# version 3. Use BrickletLaserRangeFinder#set_mode for hardware version 1. You can check
|
|
333
|
+
# the sensor hardware version using BrickletLaserRangeFinder#get_sensor_hardware_version.
|
|
334
|
+
#
|
|
335
|
+
# The **Aquisition Count** defines the number of times the Laser Range Finder Bricklet
|
|
336
|
+
# will integrate acquisitions to find a correlation record peak. With a higher count,
|
|
337
|
+
# the Bricklet can measure longer distances. With a lower count, the rate increases. The
|
|
338
|
+
# allowed values are 1-255.
|
|
339
|
+
#
|
|
340
|
+
# If you set **Enable Quick Termination** to true, the distance measurement will be terminated
|
|
341
|
+
# early if a high peak was already detected. This means that a higher measurement rate can be achieved
|
|
342
|
+
# and long distances can be measured at the same time. However, the chance of false-positive
|
|
343
|
+
# distance measurements increases.
|
|
344
|
+
#
|
|
345
|
+
# Normally the distance is calculated with a detection algorithm that uses peak value,
|
|
346
|
+
# signal strength and noise. You can however also define a fixed **Threshold Value**.
|
|
347
|
+
# Set this to a low value if you want to measure the distance to something that has
|
|
348
|
+
# very little reflection (e.g. glass) and set it to a high value if you want to measure
|
|
349
|
+
# the distance to something with a very high reflection (e.g. mirror). Set this to 0 to
|
|
350
|
+
# use the default algorithm. The other allowed values are 1-255.
|
|
351
|
+
#
|
|
352
|
+
# Set the **Measurement Frequency** in Hz to force a fixed measurement rate. If set to 0,
|
|
353
|
+
# the Laser Range Finder Bricklet will use the optimal frequency according to the other
|
|
354
|
+
# configurations and the actual measured distance. Since the rate is not fixed in this case,
|
|
355
|
+
# the velocity measurement is not stable. For a stable velocity measurement you should
|
|
356
|
+
# set a fixed measurement frequency. The lower the frequency, the higher is the resolution
|
|
357
|
+
# of the calculated velocity. The allowed values are 10Hz-500Hz (and 0 to turn the fixed
|
|
358
|
+
# frequency off).
|
|
359
|
+
#
|
|
360
|
+
# The default values for Acquisition Count, Enable Quick Termination, Threshold Value and
|
|
361
|
+
# Measurement Frequency are 128, false, 0 and 0.
|
|
362
|
+
#
|
|
363
|
+
# .. versionadded:: 2.0.3$nbsp;(Plugin)
|
|
364
|
+
def set_configuration(acquisition_count, enable_quick_termination, threshold_value, measurement_frequency)
|
|
365
|
+
send_request(FUNCTION_SET_CONFIGURATION, [acquisition_count, enable_quick_termination, threshold_value, measurement_frequency], 'C ? C S', 0, '')
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
# Returns the configuration as set by BrickletLaserRangeFinder#set_configuration.
|
|
369
|
+
#
|
|
370
|
+
# .. versionadded:: 2.0.3$nbsp;(Plugin)
|
|
371
|
+
def get_configuration
|
|
372
|
+
send_request(FUNCTION_GET_CONFIGURATION, [], '', 5, 'C ? C S')
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
|
307
376
|
# the position, the hardware and firmware version as well as the
|
|
308
377
|
# device identifier.
|
|
309
378
|
#
|