tinkerforge 2.1.13 → 2.1.14
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/tinkerforge/brick_dc.rb +122 -34
- data/lib/tinkerforge/brick_imu.rb +135 -49
- data/lib/tinkerforge/brick_imu_v2.rb +137 -54
- data/lib/tinkerforge/brick_master.rb +206 -120
- data/lib/tinkerforge/brick_red.rb +64 -69
- data/lib/tinkerforge/brick_servo.rb +133 -44
- data/lib/tinkerforge/brick_silent_stepper.rb +151 -65
- data/lib/tinkerforge/brick_stepper.rb +139 -51
- data/lib/tinkerforge/bricklet_accelerometer.rb +17 -18
- data/lib/tinkerforge/bricklet_ambient_light.rb +16 -19
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +13 -14
- data/lib/tinkerforge/bricklet_analog_in.rb +20 -23
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +18 -21
- data/lib/tinkerforge/bricklet_analog_out.rb +8 -7
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +7 -6
- data/lib/tinkerforge/bricklet_barometer.rb +21 -24
- data/lib/tinkerforge/bricklet_can.rb +14 -14
- data/lib/tinkerforge/bricklet_co2.rb +11 -12
- data/lib/tinkerforge/bricklet_color.rb +22 -25
- data/lib/tinkerforge/bricklet_current12.rb +18 -22
- data/lib/tinkerforge/bricklet_current25.rb +18 -22
- data/lib/tinkerforge/bricklet_distance_ir.rb +18 -21
- data/lib/tinkerforge/bricklet_distance_us.rb +13 -14
- data/lib/tinkerforge/bricklet_dual_button.rb +8 -8
- data/lib/tinkerforge/bricklet_dual_relay.rb +9 -9
- data/lib/tinkerforge/bricklet_dust_detector.rb +13 -14
- data/lib/tinkerforge/bricklet_gps.rb +21 -25
- data/lib/tinkerforge/bricklet_gps_v2.rb +56 -41
- data/lib/tinkerforge/bricklet_hall_effect.rb +13 -13
- data/lib/tinkerforge/bricklet_humidity.rb +16 -19
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +13 -12
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +15 -15
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +12 -12
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +13 -14
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +16 -17
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +12 -12
- data/lib/tinkerforge/bricklet_io16.rb +18 -19
- data/lib/tinkerforge/bricklet_io4.rb +18 -19
- data/lib/tinkerforge/bricklet_joystick.rb +18 -23
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +26 -29
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +14 -15
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +18 -19
- data/lib/tinkerforge/bricklet_led_strip.rb +20 -20
- data/lib/tinkerforge/bricklet_line.rb +11 -12
- data/lib/tinkerforge/bricklet_linear_poti.rb +16 -19
- data/lib/tinkerforge/bricklet_load_cell.rb +20 -21
- data/lib/tinkerforge/bricklet_moisture.rb +13 -14
- data/lib/tinkerforge/bricklet_motion_detector.rb +7 -8
- data/lib/tinkerforge/bricklet_multi_touch.rb +10 -10
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +11 -11
- data/lib/tinkerforge/bricklet_oled_128x64.rb +10 -9
- data/lib/tinkerforge/bricklet_oled_64x48.rb +10 -9
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +6 -7
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +7 -8
- data/lib/tinkerforge/bricklet_ptc.rb +23 -26
- data/lib/tinkerforge/bricklet_real_time_clock.rb +13 -14
- data/lib/tinkerforge/bricklet_remote_switch.rb +12 -12
- data/lib/tinkerforge/bricklet_rgb_led.rb +6 -5
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +12 -15
- data/lib/tinkerforge/bricklet_rotary_poti.rb +16 -19
- data/lib/tinkerforge/bricklet_rs232.rb +12 -13
- data/lib/tinkerforge/bricklet_rs485.rb +1373 -0
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +8 -8
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +8 -8
- data/lib/tinkerforge/bricklet_sound_intensity.rb +11 -12
- data/lib/tinkerforge/bricklet_temperature.rb +13 -14
- data/lib/tinkerforge/bricklet_temperature_ir.rb +18 -21
- data/lib/tinkerforge/bricklet_thermocouple.rb +14 -16
- data/lib/tinkerforge/bricklet_tilt.rb +8 -8
- data/lib/tinkerforge/bricklet_uv_light.rb +11 -12
- data/lib/tinkerforge/bricklet_voltage.rb +16 -19
- data/lib/tinkerforge/bricklet_voltage_current.rb +25 -30
- data/lib/tinkerforge/ip_connection.rb +207 -138
- 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-07-27. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.14 #
|
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 #
|
@@ -96,12 +96,6 @@ module Tinkerforge
|
|
96
96
|
@response_expected[FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
97
97
|
@response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
|
98
98
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
99
|
-
@response_expected[CALLBACK_POSITION] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
100
|
-
@response_expected[CALLBACK_ANALOG_VALUE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
101
|
-
@response_expected[CALLBACK_POSITION_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
102
|
-
@response_expected[CALLBACK_ANALOG_VALUE_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
103
|
-
@response_expected[CALLBACK_PRESSED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
104
|
-
@response_expected[CALLBACK_RELEASED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
105
99
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
106
100
|
|
107
101
|
@callback_formats[CALLBACK_POSITION] = 's s'
|
@@ -110,6 +104,7 @@ module Tinkerforge
|
|
110
104
|
@callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S S'
|
111
105
|
@callback_formats[CALLBACK_PRESSED] = ''
|
112
106
|
@callback_formats[CALLBACK_RELEASED] = ''
|
107
|
+
|
113
108
|
end
|
114
109
|
|
115
110
|
# Returns the position of the Joystick. The value ranges between -100 and
|
@@ -120,7 +115,7 @@ module Tinkerforge
|
|
120
115
|
# CALLBACK_POSITION callback and set the period with
|
121
116
|
# BrickletJoystick#set_position_callback_period.
|
122
117
|
def get_position
|
123
|
-
send_request
|
118
|
+
send_request FUNCTION_GET_POSITION, [], '', 4, 's s'
|
124
119
|
end
|
125
120
|
|
126
121
|
# Returns *true* if the button is pressed and *false* otherwise.
|
@@ -128,7 +123,7 @@ module Tinkerforge
|
|
128
123
|
# It is recommended to use the CALLBACK_PRESSED and CALLBACK_RELEASED callbacks
|
129
124
|
# to handle the button.
|
130
125
|
def is_pressed
|
131
|
-
send_request
|
126
|
+
send_request FUNCTION_IS_PRESSED, [], '', 1, '?'
|
132
127
|
end
|
133
128
|
|
134
129
|
# Returns the values as read by a 12-bit analog-to-digital converter.
|
@@ -144,7 +139,7 @@ module Tinkerforge
|
|
144
139
|
# CALLBACK_ANALOG_VALUE callback and set the period with
|
145
140
|
# BrickletJoystick#set_analog_value_callback_period.
|
146
141
|
def get_analog_value
|
147
|
-
send_request
|
142
|
+
send_request FUNCTION_GET_ANALOG_VALUE, [], '', 4, 'S S'
|
148
143
|
end
|
149
144
|
|
150
145
|
# Calibrates the middle position of the Joystick. If your Joystick Bricklet
|
@@ -154,7 +149,7 @@ module Tinkerforge
|
|
154
149
|
# The resulting calibration will be saved on the EEPROM of the Joystick
|
155
150
|
# Bricklet, thus you only have to calibrate it once.
|
156
151
|
def calibrate
|
157
|
-
send_request
|
152
|
+
send_request FUNCTION_CALIBRATE, [], '', 0, ''
|
158
153
|
end
|
159
154
|
|
160
155
|
# Sets the period in ms with which the CALLBACK_POSITION callback is triggered
|
@@ -165,12 +160,12 @@ module Tinkerforge
|
|
165
160
|
#
|
166
161
|
# The default value is 0.
|
167
162
|
def set_position_callback_period(period)
|
168
|
-
send_request
|
163
|
+
send_request FUNCTION_SET_POSITION_CALLBACK_PERIOD, [period], 'L', 0, ''
|
169
164
|
end
|
170
165
|
|
171
166
|
# Returns the period as set by BrickletJoystick#set_position_callback_period.
|
172
167
|
def get_position_callback_period
|
173
|
-
send_request
|
168
|
+
send_request FUNCTION_GET_POSITION_CALLBACK_PERIOD, [], '', 4, 'L'
|
174
169
|
end
|
175
170
|
|
176
171
|
# Sets the period in ms with which the CALLBACK_ANALOG_VALUE callback is triggered
|
@@ -181,12 +176,12 @@ module Tinkerforge
|
|
181
176
|
#
|
182
177
|
# The default value is 0.
|
183
178
|
def set_analog_value_callback_period(period)
|
184
|
-
send_request
|
179
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
185
180
|
end
|
186
181
|
|
187
182
|
# Returns the period as set by BrickletJoystick#set_analog_value_callback_period.
|
188
183
|
def get_analog_value_callback_period
|
189
|
-
send_request
|
184
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L'
|
190
185
|
end
|
191
186
|
|
192
187
|
# Sets the thresholds for the CALLBACK_POSITION_REACHED callback.
|
@@ -203,12 +198,12 @@ module Tinkerforge
|
|
203
198
|
#
|
204
199
|
# The default value is ('x', 0, 0, 0, 0).
|
205
200
|
def set_position_callback_threshold(option, min_x, max_x, min_y, max_y)
|
206
|
-
send_request
|
201
|
+
send_request FUNCTION_SET_POSITION_CALLBACK_THRESHOLD, [option, min_x, max_x, min_y, max_y], 'k s s s s', 0, ''
|
207
202
|
end
|
208
203
|
|
209
204
|
# Returns the threshold as set by BrickletJoystick#set_position_callback_threshold.
|
210
205
|
def get_position_callback_threshold
|
211
|
-
send_request
|
206
|
+
send_request FUNCTION_GET_POSITION_CALLBACK_THRESHOLD, [], '', 9, 'k s s s s'
|
212
207
|
end
|
213
208
|
|
214
209
|
# Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
|
@@ -225,12 +220,12 @@ module Tinkerforge
|
|
225
220
|
#
|
226
221
|
# The default value is ('x', 0, 0, 0, 0).
|
227
222
|
def set_analog_value_callback_threshold(option, min_x, max_x, min_y, max_y)
|
228
|
-
send_request
|
223
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min_x, max_x, min_y, max_y], 'k S S S S', 0, ''
|
229
224
|
end
|
230
225
|
|
231
226
|
# Returns the threshold as set by BrickletJoystick#set_analog_value_callback_threshold.
|
232
227
|
def get_analog_value_callback_threshold
|
233
|
-
send_request
|
228
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 9, 'k S S S S'
|
234
229
|
end
|
235
230
|
|
236
231
|
# Sets the period in ms with which the threshold callbacks
|
@@ -247,12 +242,12 @@ module Tinkerforge
|
|
247
242
|
#
|
248
243
|
# The default value is 100.
|
249
244
|
def set_debounce_period(debounce)
|
250
|
-
send_request
|
245
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
251
246
|
end
|
252
247
|
|
253
248
|
# Returns the debounce period as set by BrickletJoystick#set_debounce_period.
|
254
249
|
def get_debounce_period
|
255
|
-
send_request
|
250
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
256
251
|
end
|
257
252
|
|
258
253
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -264,7 +259,7 @@ module Tinkerforge
|
|
264
259
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
265
260
|
# |device_identifier_constant|
|
266
261
|
def get_identity
|
267
|
-
send_request
|
262
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
268
263
|
end
|
269
264
|
|
270
265
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
@@ -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-07-27. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.14 #
|
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 #
|
@@ -110,10 +110,6 @@ module Tinkerforge
|
|
110
110
|
@response_expected[FUNCTION_ENABLE_LASER] = RESPONSE_EXPECTED_FALSE
|
111
111
|
@response_expected[FUNCTION_DISABLE_LASER] = RESPONSE_EXPECTED_FALSE
|
112
112
|
@response_expected[FUNCTION_IS_LASER_ENABLED] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
113
|
-
@response_expected[CALLBACK_DISTANCE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
114
|
-
@response_expected[CALLBACK_VELOCITY] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
115
|
-
@response_expected[CALLBACK_DISTANCE_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
116
|
-
@response_expected[CALLBACK_VELOCITY_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
117
113
|
@response_expected[FUNCTION_GET_SENSOR_HARDWARE_VERSION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
118
114
|
@response_expected[FUNCTION_SET_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
|
119
115
|
@response_expected[FUNCTION_GET_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
@@ -123,6 +119,7 @@ module Tinkerforge
|
|
123
119
|
@callback_formats[CALLBACK_VELOCITY] = 's'
|
124
120
|
@callback_formats[CALLBACK_DISTANCE_REACHED] = 'S'
|
125
121
|
@callback_formats[CALLBACK_VELOCITY_REACHED] = 's'
|
122
|
+
|
126
123
|
end
|
127
124
|
|
128
125
|
# Returns the measured distance. The value has a range of 0 to 4000
|
@@ -138,7 +135,7 @@ module Tinkerforge
|
|
138
135
|
# use the CALLBACK_DISTANCE callback and set the period with
|
139
136
|
# BrickletLaserRangeFinder#set_distance_callback_period.
|
140
137
|
def get_distance
|
141
|
-
send_request
|
138
|
+
send_request FUNCTION_GET_DISTANCE, [], '', 2, 'S'
|
142
139
|
end
|
143
140
|
|
144
141
|
# Returns the measured velocity. The value has a range of -12800 to 12700
|
@@ -156,7 +153,7 @@ module Tinkerforge
|
|
156
153
|
# use the CALLBACK_VELOCITY callback and set the period with
|
157
154
|
# BrickletLaserRangeFinder#set_velocity_callback_period.
|
158
155
|
def get_velocity
|
159
|
-
send_request
|
156
|
+
send_request FUNCTION_GET_VELOCITY, [], '', 2, 's'
|
160
157
|
end
|
161
158
|
|
162
159
|
# Sets the period in ms with which the CALLBACK_DISTANCE callback is triggered
|
@@ -167,12 +164,12 @@ module Tinkerforge
|
|
167
164
|
#
|
168
165
|
# The default value is 0.
|
169
166
|
def set_distance_callback_period(period)
|
170
|
-
send_request
|
167
|
+
send_request FUNCTION_SET_DISTANCE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
171
168
|
end
|
172
169
|
|
173
170
|
# Returns the period as set by BrickletLaserRangeFinder#set_distance_callback_period.
|
174
171
|
def get_distance_callback_period
|
175
|
-
send_request
|
172
|
+
send_request FUNCTION_GET_DISTANCE_CALLBACK_PERIOD, [], '', 4, 'L'
|
176
173
|
end
|
177
174
|
|
178
175
|
# Sets the period in ms with which the CALLBACK_VELOCITY callback is triggered
|
@@ -183,12 +180,12 @@ module Tinkerforge
|
|
183
180
|
#
|
184
181
|
# The default value is 0.
|
185
182
|
def set_velocity_callback_period(period)
|
186
|
-
send_request
|
183
|
+
send_request FUNCTION_SET_VELOCITY_CALLBACK_PERIOD, [period], 'L', 0, ''
|
187
184
|
end
|
188
185
|
|
189
186
|
# Returns the period as set by BrickletLaserRangeFinder#set_velocity_callback_period.
|
190
187
|
def get_velocity_callback_period
|
191
|
-
send_request
|
188
|
+
send_request FUNCTION_GET_VELOCITY_CALLBACK_PERIOD, [], '', 4, 'L'
|
192
189
|
end
|
193
190
|
|
194
191
|
# Sets the thresholds for the CALLBACK_DISTANCE_REACHED callback.
|
@@ -205,12 +202,12 @@ module Tinkerforge
|
|
205
202
|
#
|
206
203
|
# The default value is ('x', 0, 0).
|
207
204
|
def set_distance_callback_threshold(option, min, max)
|
208
|
-
send_request
|
205
|
+
send_request FUNCTION_SET_DISTANCE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
|
209
206
|
end
|
210
207
|
|
211
208
|
# Returns the threshold as set by BrickletLaserRangeFinder#set_distance_callback_threshold.
|
212
209
|
def get_distance_callback_threshold
|
213
|
-
send_request
|
210
|
+
send_request FUNCTION_GET_DISTANCE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
|
214
211
|
end
|
215
212
|
|
216
213
|
# Sets the thresholds for the CALLBACK_VELOCITY_REACHED callback.
|
@@ -227,12 +224,12 @@ module Tinkerforge
|
|
227
224
|
#
|
228
225
|
# The default value is ('x', 0, 0).
|
229
226
|
def set_velocity_callback_threshold(option, min, max)
|
230
|
-
send_request
|
227
|
+
send_request FUNCTION_SET_VELOCITY_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 0, ''
|
231
228
|
end
|
232
229
|
|
233
230
|
# Returns the threshold as set by BrickletLaserRangeFinder#set_velocity_callback_threshold.
|
234
231
|
def get_velocity_callback_threshold
|
235
|
-
send_request
|
232
|
+
send_request FUNCTION_GET_VELOCITY_CALLBACK_THRESHOLD, [], '', 5, 'k s s'
|
236
233
|
end
|
237
234
|
|
238
235
|
# Sets the period in ms with which the threshold callbacks
|
@@ -249,12 +246,12 @@ module Tinkerforge
|
|
249
246
|
#
|
250
247
|
# The default value is 100.
|
251
248
|
def set_debounce_period(debounce)
|
252
|
-
send_request
|
249
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
253
250
|
end
|
254
251
|
|
255
252
|
# Returns the debounce period as set by BrickletLaserRangeFinder#set_debounce_period.
|
256
253
|
def get_debounce_period
|
257
|
-
send_request
|
254
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
258
255
|
end
|
259
256
|
|
260
257
|
# Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
|
@@ -267,12 +264,12 @@ module Tinkerforge
|
|
267
264
|
#
|
268
265
|
# The default value is 10.
|
269
266
|
def set_moving_average(distance_average_length, velocity_average_length)
|
270
|
-
send_request
|
267
|
+
send_request FUNCTION_SET_MOVING_AVERAGE, [distance_average_length, velocity_average_length], 'C C', 0, ''
|
271
268
|
end
|
272
269
|
|
273
270
|
# Returns the length moving average as set by BrickletLaserRangeFinder#set_moving_average.
|
274
271
|
def get_moving_average
|
275
|
-
send_request
|
272
|
+
send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 2, 'C C'
|
276
273
|
end
|
277
274
|
|
278
275
|
# .. note::
|
@@ -294,12 +291,12 @@ module Tinkerforge
|
|
294
291
|
#
|
295
292
|
# The default mode is 0 (distance is measured).
|
296
293
|
def set_mode(mode)
|
297
|
-
send_request
|
294
|
+
send_request FUNCTION_SET_MODE, [mode], 'C', 0, ''
|
298
295
|
end
|
299
296
|
|
300
297
|
# Returns the mode as set by BrickletLaserRangeFinder#set_mode.
|
301
298
|
def get_mode
|
302
|
-
send_request
|
299
|
+
send_request FUNCTION_GET_MODE, [], '', 1, 'C'
|
303
300
|
end
|
304
301
|
|
305
302
|
# Activates the laser of the LIDAR.
|
@@ -307,24 +304,24 @@ module Tinkerforge
|
|
307
304
|
# We recommend that you wait 250ms after enabling the laser before
|
308
305
|
# the first call of BrickletLaserRangeFinder#get_distance to ensure stable measurements.
|
309
306
|
def enable_laser
|
310
|
-
send_request
|
307
|
+
send_request FUNCTION_ENABLE_LASER, [], '', 0, ''
|
311
308
|
end
|
312
309
|
|
313
310
|
# Deactivates the laser of the LIDAR.
|
314
311
|
def disable_laser
|
315
|
-
send_request
|
312
|
+
send_request FUNCTION_DISABLE_LASER, [], '', 0, ''
|
316
313
|
end
|
317
314
|
|
318
315
|
# Returns *true* if the laser is enabled, *false* otherwise.
|
319
316
|
def is_laser_enabled
|
320
|
-
send_request
|
317
|
+
send_request FUNCTION_IS_LASER_ENABLED, [], '', 1, '?'
|
321
318
|
end
|
322
319
|
|
323
320
|
# Returns the LIDAR-Lite hardware version.
|
324
321
|
#
|
325
322
|
# .. versionadded:: 2.0.3$nbsp;(Plugin)
|
326
323
|
def get_sensor_hardware_version
|
327
|
-
send_request
|
324
|
+
send_request FUNCTION_GET_SENSOR_HARDWARE_VERSION, [], '', 1, 'C'
|
328
325
|
end
|
329
326
|
|
330
327
|
# .. note::
|
@@ -362,14 +359,14 @@ module Tinkerforge
|
|
362
359
|
#
|
363
360
|
# .. versionadded:: 2.0.3$nbsp;(Plugin)
|
364
361
|
def set_configuration(acquisition_count, enable_quick_termination, threshold_value, measurement_frequency)
|
365
|
-
send_request
|
362
|
+
send_request FUNCTION_SET_CONFIGURATION, [acquisition_count, enable_quick_termination, threshold_value, measurement_frequency], 'C ? C S', 0, ''
|
366
363
|
end
|
367
364
|
|
368
365
|
# Returns the configuration as set by BrickletLaserRangeFinder#set_configuration.
|
369
366
|
#
|
370
367
|
# .. versionadded:: 2.0.3$nbsp;(Plugin)
|
371
368
|
def get_configuration
|
372
|
-
send_request
|
369
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 5, 'C ? C S'
|
373
370
|
end
|
374
371
|
|
375
372
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -381,7 +378,7 @@ module Tinkerforge
|
|
381
378
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
382
379
|
# |device_identifier_constant|
|
383
380
|
def get_identity
|
384
|
-
send_request
|
381
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
385
382
|
end
|
386
383
|
|
387
384
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
@@ -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-07-27. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.14 #
|
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 #
|
@@ -51,14 +51,13 @@ module Tinkerforge
|
|
51
51
|
@response_expected[FUNCTION_SET_CONFIG] = RESPONSE_EXPECTED_FALSE
|
52
52
|
@response_expected[FUNCTION_GET_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
53
53
|
@response_expected[FUNCTION_IS_BUTTON_PRESSED] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
54
|
-
@response_expected[CALLBACK_BUTTON_PRESSED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
55
|
-
@response_expected[CALLBACK_BUTTON_RELEASED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
56
54
|
@response_expected[FUNCTION_SET_CUSTOM_CHARACTER] = RESPONSE_EXPECTED_FALSE
|
57
55
|
@response_expected[FUNCTION_GET_CUSTOM_CHARACTER] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
58
56
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
59
57
|
|
60
58
|
@callback_formats[CALLBACK_BUTTON_PRESSED] = 'C'
|
61
59
|
@callback_formats[CALLBACK_BUTTON_RELEASED] = 'C'
|
60
|
+
|
62
61
|
end
|
63
62
|
|
64
63
|
# Writes text to a specific line (0 to 1) with a specific position
|
@@ -73,27 +72,27 @@ module Tinkerforge
|
|
73
72
|
# for details. The Unicode example above shows how to specify non-ASCII characters
|
74
73
|
# and how to translate from Unicode to the LCD charset.
|
75
74
|
def write_line(line, position, text)
|
76
|
-
send_request
|
75
|
+
send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z16', 0, ''
|
77
76
|
end
|
78
77
|
|
79
78
|
# Deletes all characters from the display.
|
80
79
|
def clear_display
|
81
|
-
send_request
|
80
|
+
send_request FUNCTION_CLEAR_DISPLAY, [], '', 0, ''
|
82
81
|
end
|
83
82
|
|
84
83
|
# Turns the backlight on.
|
85
84
|
def backlight_on
|
86
|
-
send_request
|
85
|
+
send_request FUNCTION_BACKLIGHT_ON, [], '', 0, ''
|
87
86
|
end
|
88
87
|
|
89
88
|
# Turns the backlight off.
|
90
89
|
def backlight_off
|
91
|
-
send_request
|
90
|
+
send_request FUNCTION_BACKLIGHT_OFF, [], '', 0, ''
|
92
91
|
end
|
93
92
|
|
94
93
|
# Returns *true* if the backlight is on and *false* otherwise.
|
95
94
|
def is_backlight_on
|
96
|
-
send_request
|
95
|
+
send_request FUNCTION_IS_BACKLIGHT_ON, [], '', 1, '?'
|
97
96
|
end
|
98
97
|
|
99
98
|
# Configures if the cursor (shown as "_") should be visible and if it
|
@@ -103,12 +102,12 @@ module Tinkerforge
|
|
103
102
|
#
|
104
103
|
# The default is (false, false).
|
105
104
|
def set_config(cursor, blinking)
|
106
|
-
send_request
|
105
|
+
send_request FUNCTION_SET_CONFIG, [cursor, blinking], '? ?', 0, ''
|
107
106
|
end
|
108
107
|
|
109
108
|
# Returns the configuration as set by BrickletLCD16x2#set_config.
|
110
109
|
def get_config
|
111
|
-
send_request
|
110
|
+
send_request FUNCTION_GET_CONFIG, [], '', 2, '? ?'
|
112
111
|
end
|
113
112
|
|
114
113
|
# Returns *true* if the button (0 to 2) is pressed.
|
@@ -116,7 +115,7 @@ module Tinkerforge
|
|
116
115
|
# If you want to react on button presses and releases it is recommended to use the
|
117
116
|
# CALLBACK_BUTTON_PRESSED and CALLBACK_BUTTON_RELEASED callbacks.
|
118
117
|
def is_button_pressed(button)
|
119
|
-
send_request
|
118
|
+
send_request FUNCTION_IS_BUTTON_PRESSED, [button], 'C', 1, '?'
|
120
119
|
end
|
121
120
|
|
122
121
|
# The LCD 16x2 Bricklet can store up to 8 custom characters. The characters
|
@@ -144,7 +143,7 @@ module Tinkerforge
|
|
144
143
|
#
|
145
144
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
146
145
|
def set_custom_character(index, character)
|
147
|
-
send_request
|
146
|
+
send_request FUNCTION_SET_CUSTOM_CHARACTER, [index, character], 'C C8', 0, ''
|
148
147
|
end
|
149
148
|
|
150
149
|
# Returns the custom character for a given index, as set with
|
@@ -152,7 +151,7 @@ module Tinkerforge
|
|
152
151
|
#
|
153
152
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
154
153
|
def get_custom_character(index)
|
155
|
-
send_request
|
154
|
+
send_request FUNCTION_GET_CUSTOM_CHARACTER, [index], 'C', 8, 'C8'
|
156
155
|
end
|
157
156
|
|
158
157
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -164,7 +163,7 @@ module Tinkerforge
|
|
164
163
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
165
164
|
# |device_identifier_constant|
|
166
165
|
def get_identity
|
167
|
-
send_request
|
166
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
168
167
|
end
|
169
168
|
|
170
169
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
@@ -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-07-27. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.14 #
|
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 #
|
@@ -55,8 +55,6 @@ module Tinkerforge
|
|
55
55
|
@response_expected[FUNCTION_SET_CONFIG] = RESPONSE_EXPECTED_FALSE
|
56
56
|
@response_expected[FUNCTION_GET_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
57
57
|
@response_expected[FUNCTION_IS_BUTTON_PRESSED] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
58
|
-
@response_expected[CALLBACK_BUTTON_PRESSED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
59
|
-
@response_expected[CALLBACK_BUTTON_RELEASED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
60
58
|
@response_expected[FUNCTION_SET_CUSTOM_CHARACTER] = RESPONSE_EXPECTED_FALSE
|
61
59
|
@response_expected[FUNCTION_GET_CUSTOM_CHARACTER] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
62
60
|
@response_expected[FUNCTION_SET_DEFAULT_TEXT] = RESPONSE_EXPECTED_FALSE
|
@@ -67,6 +65,7 @@ module Tinkerforge
|
|
67
65
|
|
68
66
|
@callback_formats[CALLBACK_BUTTON_PRESSED] = 'C'
|
69
67
|
@callback_formats[CALLBACK_BUTTON_RELEASED] = 'C'
|
68
|
+
|
70
69
|
end
|
71
70
|
|
72
71
|
# Writes text to a specific line (0 to 3) with a specific position
|
@@ -81,27 +80,27 @@ module Tinkerforge
|
|
81
80
|
# for details. The Unicode example above shows how to specify non-ASCII characters
|
82
81
|
# and how to translate from Unicode to the LCD charset.
|
83
82
|
def write_line(line, position, text)
|
84
|
-
send_request
|
83
|
+
send_request FUNCTION_WRITE_LINE, [line, position, text], 'C C Z20', 0, ''
|
85
84
|
end
|
86
85
|
|
87
86
|
# Deletes all characters from the display.
|
88
87
|
def clear_display
|
89
|
-
send_request
|
88
|
+
send_request FUNCTION_CLEAR_DISPLAY, [], '', 0, ''
|
90
89
|
end
|
91
90
|
|
92
91
|
# Turns the backlight on.
|
93
92
|
def backlight_on
|
94
|
-
send_request
|
93
|
+
send_request FUNCTION_BACKLIGHT_ON, [], '', 0, ''
|
95
94
|
end
|
96
95
|
|
97
96
|
# Turns the backlight off.
|
98
97
|
def backlight_off
|
99
|
-
send_request
|
98
|
+
send_request FUNCTION_BACKLIGHT_OFF, [], '', 0, ''
|
100
99
|
end
|
101
100
|
|
102
101
|
# Returns *true* if the backlight is on and *false* otherwise.
|
103
102
|
def is_backlight_on
|
104
|
-
send_request
|
103
|
+
send_request FUNCTION_IS_BACKLIGHT_ON, [], '', 1, '?'
|
105
104
|
end
|
106
105
|
|
107
106
|
# Configures if the cursor (shown as "_") should be visible and if it
|
@@ -111,12 +110,12 @@ module Tinkerforge
|
|
111
110
|
#
|
112
111
|
# The default is (*false*, *false*).
|
113
112
|
def set_config(cursor, blinking)
|
114
|
-
send_request
|
113
|
+
send_request FUNCTION_SET_CONFIG, [cursor, blinking], '? ?', 0, ''
|
115
114
|
end
|
116
115
|
|
117
116
|
# Returns the configuration as set by BrickletLCD20x4#set_config.
|
118
117
|
def get_config
|
119
|
-
send_request
|
118
|
+
send_request FUNCTION_GET_CONFIG, [], '', 2, '? ?'
|
120
119
|
end
|
121
120
|
|
122
121
|
# Returns *true* if the button (0 to 2 or 0 to 3 since hardware version 1.2)
|
@@ -125,7 +124,7 @@ module Tinkerforge
|
|
125
124
|
# If you want to react on button presses and releases it is recommended to use
|
126
125
|
# the CALLBACK_BUTTON_PRESSED and CALLBACK_BUTTON_RELEASED callbacks.
|
127
126
|
def is_button_pressed(button)
|
128
|
-
send_request
|
127
|
+
send_request FUNCTION_IS_BUTTON_PRESSED, [button], 'C', 1, '?'
|
129
128
|
end
|
130
129
|
|
131
130
|
# The LCD 20x4 Bricklet can store up to 8 custom characters. The characters
|
@@ -153,7 +152,7 @@ module Tinkerforge
|
|
153
152
|
#
|
154
153
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
155
154
|
def set_custom_character(index, character)
|
156
|
-
send_request
|
155
|
+
send_request FUNCTION_SET_CUSTOM_CHARACTER, [index, character], 'C C8', 0, ''
|
157
156
|
end
|
158
157
|
|
159
158
|
# Returns the custom character for a given index, as set with
|
@@ -161,7 +160,7 @@ module Tinkerforge
|
|
161
160
|
#
|
162
161
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
163
162
|
def get_custom_character(index)
|
164
|
-
send_request
|
163
|
+
send_request FUNCTION_GET_CUSTOM_CHARACTER, [index], 'C', 8, 'C8'
|
165
164
|
end
|
166
165
|
|
167
166
|
# Sets the default text for lines 0-3. The max number of characters
|
@@ -172,7 +171,7 @@ module Tinkerforge
|
|
172
171
|
#
|
173
172
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
174
173
|
def set_default_text(line, text)
|
175
|
-
send_request
|
174
|
+
send_request FUNCTION_SET_DEFAULT_TEXT, [line, text], 'C Z20', 0, ''
|
176
175
|
end
|
177
176
|
|
178
177
|
# Returns the default text for a given line (0-3) as set by
|
@@ -180,7 +179,7 @@ module Tinkerforge
|
|
180
179
|
#
|
181
180
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
182
181
|
def get_default_text(line)
|
183
|
-
send_request
|
182
|
+
send_request FUNCTION_GET_DEFAULT_TEXT, [line], 'C', 20, 'Z20'
|
184
183
|
end
|
185
184
|
|
186
185
|
# Sets the default text counter in ms. This counter is decremented each
|
@@ -201,14 +200,14 @@ module Tinkerforge
|
|
201
200
|
#
|
202
201
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
203
202
|
def set_default_text_counter(counter)
|
204
|
-
send_request
|
203
|
+
send_request FUNCTION_SET_DEFAULT_TEXT_COUNTER, [counter], 'l', 0, ''
|
205
204
|
end
|
206
205
|
|
207
206
|
# Returns the current value of the default text counter.
|
208
207
|
#
|
209
208
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
210
209
|
def get_default_text_counter
|
211
|
-
send_request
|
210
|
+
send_request FUNCTION_GET_DEFAULT_TEXT_COUNTER, [], '', 4, 'l'
|
212
211
|
end
|
213
212
|
|
214
213
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -220,7 +219,7 @@ module Tinkerforge
|
|
220
219
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
221
220
|
# |device_identifier_constant|
|
222
221
|
def get_identity
|
223
|
-
send_request
|
222
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
224
223
|
end
|
225
224
|
|
226
225
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|