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 #
|
@@ -90,7 +90,6 @@ module Tinkerforge
|
|
90
90
|
@response_expected[FUNCTION_SET_FRAME_DURATION] = RESPONSE_EXPECTED_FALSE
|
91
91
|
@response_expected[FUNCTION_GET_FRAME_DURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
92
92
|
@response_expected[FUNCTION_GET_SUPPLY_VOLTAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
93
|
-
@response_expected[CALLBACK_FRAME_RENDERED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
94
93
|
@response_expected[FUNCTION_SET_CLOCK_FREQUENCY] = RESPONSE_EXPECTED_FALSE
|
95
94
|
@response_expected[FUNCTION_GET_CLOCK_FREQUENCY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
96
95
|
@response_expected[FUNCTION_SET_CHIP_TYPE] = RESPONSE_EXPECTED_FALSE
|
@@ -105,6 +104,7 @@ module Tinkerforge
|
|
105
104
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
106
105
|
|
107
106
|
@callback_formats[CALLBACK_FRAME_RENDERED] = 'S'
|
107
|
+
|
108
108
|
end
|
109
109
|
|
110
110
|
# Sets the RGB values for the LEDs with the given *length* starting
|
@@ -150,7 +150,7 @@ module Tinkerforge
|
|
150
150
|
# information. A call of BrickletLEDStrip#set_rgb_values with index + length above the
|
151
151
|
# bounds is ignored completely.
|
152
152
|
def set_rgb_values(index, length, r, g, b)
|
153
|
-
send_request
|
153
|
+
send_request FUNCTION_SET_RGB_VALUES, [index, length, r, g, b], 'S C C16 C16 C16', 0, ''
|
154
154
|
end
|
155
155
|
|
156
156
|
# Returns RGB value with the given *length* starting from the
|
@@ -158,7 +158,7 @@ module Tinkerforge
|
|
158
158
|
#
|
159
159
|
# The values are the last values that were set by BrickletLEDStrip#set_rgb_values.
|
160
160
|
def get_rgb_values(index, length)
|
161
|
-
send_request
|
161
|
+
send_request FUNCTION_GET_RGB_VALUES, [index, length], 'S C', 48, 'C16 C16 C16'
|
162
162
|
end
|
163
163
|
|
164
164
|
# Sets the frame duration in ms.
|
@@ -170,17 +170,17 @@ module Tinkerforge
|
|
170
170
|
#
|
171
171
|
# Default value: 100ms (10 frames per second).
|
172
172
|
def set_frame_duration(duration)
|
173
|
-
send_request
|
173
|
+
send_request FUNCTION_SET_FRAME_DURATION, [duration], 'S', 0, ''
|
174
174
|
end
|
175
175
|
|
176
176
|
# Returns the frame duration in ms as set by BrickletLEDStrip#set_frame_duration.
|
177
177
|
def get_frame_duration
|
178
|
-
send_request
|
178
|
+
send_request FUNCTION_GET_FRAME_DURATION, [], '', 2, 'S'
|
179
179
|
end
|
180
180
|
|
181
181
|
# Returns the current supply voltage of the LEDs. The voltage is given in mV.
|
182
182
|
def get_supply_voltage
|
183
|
-
send_request
|
183
|
+
send_request FUNCTION_GET_SUPPLY_VOLTAGE, [], '', 2, 'S'
|
184
184
|
end
|
185
185
|
|
186
186
|
# Sets the frequency of the clock in Hz. The range is 10000Hz (10kHz) up to
|
@@ -204,14 +204,14 @@ module Tinkerforge
|
|
204
204
|
#
|
205
205
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
206
206
|
def set_clock_frequency(frequency)
|
207
|
-
send_request
|
207
|
+
send_request FUNCTION_SET_CLOCK_FREQUENCY, [frequency], 'L', 0, ''
|
208
208
|
end
|
209
209
|
|
210
210
|
# Returns the currently used clock frequency as set by BrickletLEDStrip#set_clock_frequency.
|
211
211
|
#
|
212
212
|
# .. versionadded:: 2.0.1$nbsp;(Plugin)
|
213
213
|
def get_clock_frequency
|
214
|
-
send_request
|
214
|
+
send_request FUNCTION_GET_CLOCK_FREQUENCY, [], '', 4, 'L'
|
215
215
|
end
|
216
216
|
|
217
217
|
# Sets the type of the LED driver chip. We currently support the chips
|
@@ -227,14 +227,14 @@ module Tinkerforge
|
|
227
227
|
#
|
228
228
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
229
229
|
def set_chip_type(chip)
|
230
|
-
send_request
|
230
|
+
send_request FUNCTION_SET_CHIP_TYPE, [chip], 'S', 0, ''
|
231
231
|
end
|
232
232
|
|
233
233
|
# Returns the currently used chip type as set by BrickletLEDStrip#set_chip_type.
|
234
234
|
#
|
235
235
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
236
236
|
def get_chip_type
|
237
|
-
send_request
|
237
|
+
send_request FUNCTION_GET_CHIP_TYPE, [], '', 2, 'S'
|
238
238
|
end
|
239
239
|
|
240
240
|
# Sets the RGBW values for the LEDs with the given *length* starting
|
@@ -293,7 +293,7 @@ module Tinkerforge
|
|
293
293
|
#
|
294
294
|
# .. versionadded:: 2.0.6$nbsp;(Plugin)
|
295
295
|
def set_rgbw_values(index, length, r, g, b, w)
|
296
|
-
send_request
|
296
|
+
send_request FUNCTION_SET_RGBW_VALUES, [index, length, r, g, b, w], 'S C C12 C12 C12 C12', 0, ''
|
297
297
|
end
|
298
298
|
|
299
299
|
# Returns RGBW values with the given *length* starting from the
|
@@ -303,7 +303,7 @@ module Tinkerforge
|
|
303
303
|
#
|
304
304
|
# .. versionadded:: 2.0.6$nbsp;(Plugin)
|
305
305
|
def get_rgbw_values(index, length)
|
306
|
-
send_request
|
306
|
+
send_request FUNCTION_GET_RGBW_VALUES, [index, length], 'S C', 48, 'C12 C12 C12 C12'
|
307
307
|
end
|
308
308
|
|
309
309
|
# Sets the channel mapping for the connected LEDs.
|
@@ -330,14 +330,14 @@ module Tinkerforge
|
|
330
330
|
#
|
331
331
|
# .. versionadded:: 2.0.6$nbsp;(Plugin)
|
332
332
|
def set_channel_mapping(mapping)
|
333
|
-
send_request
|
333
|
+
send_request FUNCTION_SET_CHANNEL_MAPPING, [mapping], 'C', 0, ''
|
334
334
|
end
|
335
335
|
|
336
336
|
# Returns the currently used channel mapping as set by BrickletLEDStrip#set_channel_mapping.
|
337
337
|
#
|
338
338
|
# .. versionadded:: 2.0.6$nbsp;(Plugin)
|
339
339
|
def get_channel_mapping
|
340
|
-
send_request
|
340
|
+
send_request FUNCTION_GET_CHANNEL_MAPPING, [], '', 1, 'C'
|
341
341
|
end
|
342
342
|
|
343
343
|
# Enables the CALLBACK_FRAME_RENDERED callback.
|
@@ -346,7 +346,7 @@ module Tinkerforge
|
|
346
346
|
#
|
347
347
|
# .. versionadded:: 2.0.6$nbsp;(Plugin)
|
348
348
|
def enable_frame_rendered_callback
|
349
|
-
send_request
|
349
|
+
send_request FUNCTION_ENABLE_FRAME_RENDERED_CALLBACK, [], '', 0, ''
|
350
350
|
end
|
351
351
|
|
352
352
|
# Disables the CALLBACK_FRAME_RENDERED callback.
|
@@ -355,14 +355,14 @@ module Tinkerforge
|
|
355
355
|
#
|
356
356
|
# .. versionadded:: 2.0.6$nbsp;(Plugin)
|
357
357
|
def disable_frame_rendered_callback
|
358
|
-
send_request
|
358
|
+
send_request FUNCTION_DISABLE_FRAME_RENDERED_CALLBACK, [], '', 0, ''
|
359
359
|
end
|
360
360
|
|
361
361
|
# Returns *true* if the CALLBACK_FRAME_RENDERED callback is enabled, *false* otherwise.
|
362
362
|
#
|
363
363
|
# .. versionadded:: 2.0.6$nbsp;(Plugin)
|
364
364
|
def is_frame_rendered_callback_enabled
|
365
|
-
send_request
|
365
|
+
send_request FUNCTION_IS_FRAME_RENDERED_CALLBACK_ENABLED, [], '', 1, '?'
|
366
366
|
end
|
367
367
|
|
368
368
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -374,7 +374,7 @@ module Tinkerforge
|
|
374
374
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
375
375
|
# |device_identifier_constant|
|
376
376
|
def get_identity
|
377
|
-
send_request
|
377
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
378
378
|
end
|
379
379
|
|
380
380
|
# 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 #
|
@@ -60,12 +60,11 @@ module Tinkerforge
|
|
60
60
|
@response_expected[FUNCTION_GET_REFLECTIVITY_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
61
61
|
@response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
|
62
62
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
63
|
-
@response_expected[CALLBACK_REFLECTIVITY] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
64
|
-
@response_expected[CALLBACK_REFLECTIVITY_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
65
63
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
66
64
|
|
67
65
|
@callback_formats[CALLBACK_REFLECTIVITY] = 'S'
|
68
66
|
@callback_formats[CALLBACK_REFLECTIVITY_REACHED] = 'S'
|
67
|
+
|
69
68
|
end
|
70
69
|
|
71
70
|
# Returns the currently measured reflectivity. The reflectivity is
|
@@ -78,7 +77,7 @@ module Tinkerforge
|
|
78
77
|
# to use the CALLBACK_REFLECTIVITY callback and set the period with
|
79
78
|
# BrickletLine#set_reflectivity_callback_period.
|
80
79
|
def get_reflectivity
|
81
|
-
send_request
|
80
|
+
send_request FUNCTION_GET_REFLECTIVITY, [], '', 2, 'S'
|
82
81
|
end
|
83
82
|
|
84
83
|
# Sets the period in ms with which the CALLBACK_REFLECTIVITY callback is triggered
|
@@ -89,12 +88,12 @@ module Tinkerforge
|
|
89
88
|
#
|
90
89
|
# The default value is 0.
|
91
90
|
def set_reflectivity_callback_period(period)
|
92
|
-
send_request
|
91
|
+
send_request FUNCTION_SET_REFLECTIVITY_CALLBACK_PERIOD, [period], 'L', 0, ''
|
93
92
|
end
|
94
93
|
|
95
94
|
# Returns the period as set by BrickletLine#set_reflectivity_callback_period.
|
96
95
|
def get_reflectivity_callback_period
|
97
|
-
send_request
|
96
|
+
send_request FUNCTION_GET_REFLECTIVITY_CALLBACK_PERIOD, [], '', 4, 'L'
|
98
97
|
end
|
99
98
|
|
100
99
|
# Sets the thresholds for the CALLBACK_REFLECTIVITY_REACHED callback.
|
@@ -111,12 +110,12 @@ module Tinkerforge
|
|
111
110
|
#
|
112
111
|
# The default value is ('x', 0, 0).
|
113
112
|
def set_reflectivity_callback_threshold(option, min, max)
|
114
|
-
send_request
|
113
|
+
send_request FUNCTION_SET_REFLECTIVITY_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
|
115
114
|
end
|
116
115
|
|
117
116
|
# Returns the threshold as set by BrickletLine#set_reflectivity_callback_threshold.
|
118
117
|
def get_reflectivity_callback_threshold
|
119
|
-
send_request
|
118
|
+
send_request FUNCTION_GET_REFLECTIVITY_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
|
120
119
|
end
|
121
120
|
|
122
121
|
# Sets the period in ms with which the threshold callback
|
@@ -131,12 +130,12 @@ module Tinkerforge
|
|
131
130
|
#
|
132
131
|
# The default value is 100.
|
133
132
|
def set_debounce_period(debounce)
|
134
|
-
send_request
|
133
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
135
134
|
end
|
136
135
|
|
137
136
|
# Returns the debounce period as set by BrickletLine#set_debounce_period.
|
138
137
|
def get_debounce_period
|
139
|
-
send_request
|
138
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
140
139
|
end
|
141
140
|
|
142
141
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -148,7 +147,7 @@ module Tinkerforge
|
|
148
147
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
149
148
|
# |device_identifier_constant|
|
150
149
|
def get_identity
|
151
|
-
send_request
|
150
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
152
151
|
end
|
153
152
|
|
154
153
|
# 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 #
|
@@ -86,16 +86,13 @@ module Tinkerforge
|
|
86
86
|
@response_expected[FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
87
87
|
@response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
|
88
88
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
89
|
-
@response_expected[CALLBACK_POSITION] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
90
|
-
@response_expected[CALLBACK_ANALOG_VALUE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
91
|
-
@response_expected[CALLBACK_POSITION_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
92
|
-
@response_expected[CALLBACK_ANALOG_VALUE_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
93
89
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
94
90
|
|
95
91
|
@callback_formats[CALLBACK_POSITION] = 'S'
|
96
92
|
@callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
|
97
93
|
@callback_formats[CALLBACK_POSITION_REACHED] = 'S'
|
98
94
|
@callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
|
95
|
+
|
99
96
|
end
|
100
97
|
|
101
98
|
# Returns the position of the linear potentiometer. The value is
|
@@ -105,7 +102,7 @@ module Tinkerforge
|
|
105
102
|
# CALLBACK_POSITION callback and set the period with
|
106
103
|
# BrickletLinearPoti#set_position_callback_period.
|
107
104
|
def get_position
|
108
|
-
send_request
|
105
|
+
send_request FUNCTION_GET_POSITION, [], '', 2, 'S'
|
109
106
|
end
|
110
107
|
|
111
108
|
# Returns the value as read by a 12-bit analog-to-digital converter.
|
@@ -121,7 +118,7 @@ module Tinkerforge
|
|
121
118
|
# CALLBACK_ANALOG_VALUE callback and set the period with
|
122
119
|
# BrickletLinearPoti#set_analog_value_callback_period.
|
123
120
|
def get_analog_value
|
124
|
-
send_request
|
121
|
+
send_request FUNCTION_GET_ANALOG_VALUE, [], '', 2, 'S'
|
125
122
|
end
|
126
123
|
|
127
124
|
# Sets the period in ms with which the CALLBACK_POSITION callback is triggered
|
@@ -132,12 +129,12 @@ module Tinkerforge
|
|
132
129
|
#
|
133
130
|
# The default value is 0.
|
134
131
|
def set_position_callback_period(period)
|
135
|
-
send_request
|
132
|
+
send_request FUNCTION_SET_POSITION_CALLBACK_PERIOD, [period], 'L', 0, ''
|
136
133
|
end
|
137
134
|
|
138
135
|
# Returns the period as set by BrickletLinearPoti#set_position_callback_period.
|
139
136
|
def get_position_callback_period
|
140
|
-
send_request
|
137
|
+
send_request FUNCTION_GET_POSITION_CALLBACK_PERIOD, [], '', 4, 'L'
|
141
138
|
end
|
142
139
|
|
143
140
|
# Sets the period in ms with which the CALLBACK_ANALOG_VALUE callback is triggered
|
@@ -148,12 +145,12 @@ module Tinkerforge
|
|
148
145
|
#
|
149
146
|
# The default value is 0.
|
150
147
|
def set_analog_value_callback_period(period)
|
151
|
-
send_request
|
148
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
152
149
|
end
|
153
150
|
|
154
151
|
# Returns the period as set by BrickletLinearPoti#set_analog_value_callback_period.
|
155
152
|
def get_analog_value_callback_period
|
156
|
-
send_request
|
153
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L'
|
157
154
|
end
|
158
155
|
|
159
156
|
# Sets the thresholds for the CALLBACK_POSITION_REACHED callback.
|
@@ -170,12 +167,12 @@ module Tinkerforge
|
|
170
167
|
#
|
171
168
|
# The default value is ('x', 0, 0).
|
172
169
|
def set_position_callback_threshold(option, min, max)
|
173
|
-
send_request
|
170
|
+
send_request FUNCTION_SET_POSITION_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
|
174
171
|
end
|
175
172
|
|
176
173
|
# Returns the threshold as set by BrickletLinearPoti#set_position_callback_threshold.
|
177
174
|
def get_position_callback_threshold
|
178
|
-
send_request
|
175
|
+
send_request FUNCTION_GET_POSITION_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
|
179
176
|
end
|
180
177
|
|
181
178
|
# Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
|
@@ -192,12 +189,12 @@ module Tinkerforge
|
|
192
189
|
#
|
193
190
|
# The default value is ('x', 0, 0).
|
194
191
|
def set_analog_value_callback_threshold(option, min, max)
|
195
|
-
send_request
|
192
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
|
196
193
|
end
|
197
194
|
|
198
195
|
# Returns the threshold as set by BrickletLinearPoti#set_analog_value_callback_threshold.
|
199
196
|
def get_analog_value_callback_threshold
|
200
|
-
send_request
|
197
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
|
201
198
|
end
|
202
199
|
|
203
200
|
# Sets the period in ms with which the threshold callbacks
|
@@ -214,12 +211,12 @@ module Tinkerforge
|
|
214
211
|
#
|
215
212
|
# The default value is 100.
|
216
213
|
def set_debounce_period(debounce)
|
217
|
-
send_request
|
214
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
218
215
|
end
|
219
216
|
|
220
217
|
# Returns the debounce period as set by BrickletLinearPoti#set_debounce_period.
|
221
218
|
def get_debounce_period
|
222
|
-
send_request
|
219
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
223
220
|
end
|
224
221
|
|
225
222
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -231,7 +228,7 @@ module Tinkerforge
|
|
231
228
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
232
229
|
# |device_identifier_constant|
|
233
230
|
def get_identity
|
234
|
-
send_request
|
231
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
235
232
|
end
|
236
233
|
|
237
234
|
# 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 #
|
@@ -83,12 +83,11 @@ module Tinkerforge
|
|
83
83
|
@response_expected[FUNCTION_TARE] = RESPONSE_EXPECTED_FALSE
|
84
84
|
@response_expected[FUNCTION_SET_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
|
85
85
|
@response_expected[FUNCTION_GET_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
86
|
-
@response_expected[CALLBACK_WEIGHT] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
87
|
-
@response_expected[CALLBACK_WEIGHT_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
88
86
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
89
87
|
|
90
88
|
@callback_formats[CALLBACK_WEIGHT] = 'l'
|
91
89
|
@callback_formats[CALLBACK_WEIGHT_REACHED] = 'l'
|
90
|
+
|
92
91
|
end
|
93
92
|
|
94
93
|
# Returns the currently measured weight in grams.
|
@@ -97,7 +96,7 @@ module Tinkerforge
|
|
97
96
|
# to use the CALLBACK_WEIGHT callback and set the period with
|
98
97
|
# BrickletLoadCell#set_weight_callback_period.
|
99
98
|
def get_weight
|
100
|
-
send_request
|
99
|
+
send_request FUNCTION_GET_WEIGHT, [], '', 4, 'l'
|
101
100
|
end
|
102
101
|
|
103
102
|
# Sets the period in ms with which the CALLBACK_WEIGHT callback is triggered
|
@@ -108,12 +107,12 @@ module Tinkerforge
|
|
108
107
|
#
|
109
108
|
# The default value is 0.
|
110
109
|
def set_weight_callback_period(period)
|
111
|
-
send_request
|
110
|
+
send_request FUNCTION_SET_WEIGHT_CALLBACK_PERIOD, [period], 'L', 0, ''
|
112
111
|
end
|
113
112
|
|
114
113
|
# Returns the period as set by BrickletLoadCell#set_weight_callback_period.
|
115
114
|
def get_weight_callback_period
|
116
|
-
send_request
|
115
|
+
send_request FUNCTION_GET_WEIGHT_CALLBACK_PERIOD, [], '', 4, 'L'
|
117
116
|
end
|
118
117
|
|
119
118
|
# Sets the thresholds for the CALLBACK_WEIGHT_REACHED callback.
|
@@ -130,12 +129,12 @@ module Tinkerforge
|
|
130
129
|
#
|
131
130
|
# The default value is ('x', 0, 0).
|
132
131
|
def set_weight_callback_threshold(option, min, max)
|
133
|
-
send_request
|
132
|
+
send_request FUNCTION_SET_WEIGHT_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, ''
|
134
133
|
end
|
135
134
|
|
136
135
|
# Returns the threshold as set by BrickletLoadCell#set_weight_callback_threshold.
|
137
136
|
def get_weight_callback_threshold
|
138
|
-
send_request
|
137
|
+
send_request FUNCTION_GET_WEIGHT_CALLBACK_THRESHOLD, [], '', 9, 'k l l'
|
139
138
|
end
|
140
139
|
|
141
140
|
# Sets the period in ms with which the threshold callback
|
@@ -150,12 +149,12 @@ module Tinkerforge
|
|
150
149
|
#
|
151
150
|
# The default value is 100.
|
152
151
|
def set_debounce_period(debounce)
|
153
|
-
send_request
|
152
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
154
153
|
end
|
155
154
|
|
156
155
|
# Returns the debounce period as set by BrickletLoadCell#set_debounce_period.
|
157
156
|
def get_debounce_period
|
158
|
-
send_request
|
157
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
159
158
|
end
|
160
159
|
|
161
160
|
# Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
|
@@ -168,27 +167,27 @@ module Tinkerforge
|
|
168
167
|
#
|
169
168
|
# The default value is 4.
|
170
169
|
def set_moving_average(average)
|
171
|
-
send_request
|
170
|
+
send_request FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 0, ''
|
172
171
|
end
|
173
172
|
|
174
173
|
# Returns the length moving average as set by BrickletLoadCell#set_moving_average.
|
175
174
|
def get_moving_average
|
176
|
-
send_request
|
175
|
+
send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 1, 'C'
|
177
176
|
end
|
178
177
|
|
179
178
|
# Turns the LED on.
|
180
179
|
def led_on
|
181
|
-
send_request
|
180
|
+
send_request FUNCTION_LED_ON, [], '', 0, ''
|
182
181
|
end
|
183
182
|
|
184
183
|
# Turns the LED off.
|
185
184
|
def led_off
|
186
|
-
send_request
|
185
|
+
send_request FUNCTION_LED_OFF, [], '', 0, ''
|
187
186
|
end
|
188
187
|
|
189
188
|
# Returns *true* if the led is on, *false* otherwise.
|
190
189
|
def is_led_on
|
191
|
-
send_request
|
190
|
+
send_request FUNCTION_IS_LED_ON, [], '', 1, '?'
|
192
191
|
end
|
193
192
|
|
194
193
|
# To calibrate your Load Cell Bricklet you have to
|
@@ -203,12 +202,12 @@ module Tinkerforge
|
|
203
202
|
# We recommend to use the Brick Viewer for calibration, you don't need
|
204
203
|
# to call this function in your source code.
|
205
204
|
def calibrate(weight)
|
206
|
-
send_request
|
205
|
+
send_request FUNCTION_CALIBRATE, [weight], 'L', 0, ''
|
207
206
|
end
|
208
207
|
|
209
208
|
# Sets the currently measured weight as tare weight.
|
210
209
|
def tare
|
211
|
-
send_request
|
210
|
+
send_request FUNCTION_TARE, [], '', 0, ''
|
212
211
|
end
|
213
212
|
|
214
213
|
# The measurement rate and gain are configurable.
|
@@ -232,12 +231,12 @@ module Tinkerforge
|
|
232
231
|
#
|
233
232
|
# The default rate is 10Hz and the default gain is 128x.
|
234
233
|
def set_configuration(rate, gain)
|
235
|
-
send_request
|
234
|
+
send_request FUNCTION_SET_CONFIGURATION, [rate, gain], 'C C', 0, ''
|
236
235
|
end
|
237
236
|
|
238
237
|
# Returns the configuration as set by BrickletLoadCell#set_configuration.
|
239
238
|
def get_configuration
|
240
|
-
send_request
|
239
|
+
send_request FUNCTION_GET_CONFIGURATION, [], '', 2, 'C C'
|
241
240
|
end
|
242
241
|
|
243
242
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -249,7 +248,7 @@ module Tinkerforge
|
|
249
248
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
250
249
|
# |device_identifier_constant|
|
251
250
|
def get_identity
|
252
|
-
send_request
|
251
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
253
252
|
end
|
254
253
|
|
255
254
|
# 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 #
|
@@ -62,14 +62,13 @@ module Tinkerforge
|
|
62
62
|
@response_expected[FUNCTION_GET_MOISTURE_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
63
63
|
@response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
|
64
64
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
65
|
-
@response_expected[CALLBACK_MOISTURE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
66
|
-
@response_expected[CALLBACK_MOISTURE_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
67
65
|
@response_expected[FUNCTION_SET_MOVING_AVERAGE] = RESPONSE_EXPECTED_FALSE
|
68
66
|
@response_expected[FUNCTION_GET_MOVING_AVERAGE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
69
67
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
70
68
|
|
71
69
|
@callback_formats[CALLBACK_MOISTURE] = 'S'
|
72
70
|
@callback_formats[CALLBACK_MOISTURE_REACHED] = 'S'
|
71
|
+
|
73
72
|
end
|
74
73
|
|
75
74
|
# Returns the current moisture value. The value has a range of
|
@@ -80,7 +79,7 @@ module Tinkerforge
|
|
80
79
|
# to use the CALLBACK_MOISTURE callback and set the period with
|
81
80
|
# BrickletMoisture#set_moisture_callback_period.
|
82
81
|
def get_moisture_value
|
83
|
-
send_request
|
82
|
+
send_request FUNCTION_GET_MOISTURE_VALUE, [], '', 2, 'S'
|
84
83
|
end
|
85
84
|
|
86
85
|
# Sets the period in ms with which the CALLBACK_MOISTURE callback is triggered
|
@@ -91,12 +90,12 @@ module Tinkerforge
|
|
91
90
|
#
|
92
91
|
# The default value is 0.
|
93
92
|
def set_moisture_callback_period(period)
|
94
|
-
send_request
|
93
|
+
send_request FUNCTION_SET_MOISTURE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
95
94
|
end
|
96
95
|
|
97
96
|
# Returns the period as set by BrickletMoisture#set_moisture_callback_period.
|
98
97
|
def get_moisture_callback_period
|
99
|
-
send_request
|
98
|
+
send_request FUNCTION_GET_MOISTURE_CALLBACK_PERIOD, [], '', 4, 'L'
|
100
99
|
end
|
101
100
|
|
102
101
|
# Sets the thresholds for the CALLBACK_MOISTURE_REACHED callback.
|
@@ -113,12 +112,12 @@ module Tinkerforge
|
|
113
112
|
#
|
114
113
|
# The default value is ('x', 0, 0).
|
115
114
|
def set_moisture_callback_threshold(option, min, max)
|
116
|
-
send_request
|
115
|
+
send_request FUNCTION_SET_MOISTURE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
|
117
116
|
end
|
118
117
|
|
119
118
|
# Returns the threshold as set by BrickletMoisture#set_moisture_callback_threshold.
|
120
119
|
def get_moisture_callback_threshold
|
121
|
-
send_request
|
120
|
+
send_request FUNCTION_GET_MOISTURE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
|
122
121
|
end
|
123
122
|
|
124
123
|
# Sets the period in ms with which the threshold callback
|
@@ -133,12 +132,12 @@ module Tinkerforge
|
|
133
132
|
#
|
134
133
|
# The default value is 100.
|
135
134
|
def set_debounce_period(debounce)
|
136
|
-
send_request
|
135
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
137
136
|
end
|
138
137
|
|
139
138
|
# Returns the debounce period as set by BrickletMoisture#set_debounce_period.
|
140
139
|
def get_debounce_period
|
141
|
-
send_request
|
140
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
142
141
|
end
|
143
142
|
|
144
143
|
# Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
|
@@ -151,12 +150,12 @@ module Tinkerforge
|
|
151
150
|
#
|
152
151
|
# The default value is 100.
|
153
152
|
def set_moving_average(average)
|
154
|
-
send_request
|
153
|
+
send_request FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 0, ''
|
155
154
|
end
|
156
155
|
|
157
156
|
# Returns the length moving average as set by BrickletMoisture#set_moving_average.
|
158
157
|
def get_moving_average
|
159
|
-
send_request
|
158
|
+
send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 1, 'C'
|
160
159
|
end
|
161
160
|
|
162
161
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -168,7 +167,7 @@ module Tinkerforge
|
|
168
167
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
169
168
|
# |device_identifier_constant|
|
170
169
|
def get_identity
|
171
|
-
send_request
|
170
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
172
171
|
end
|
173
172
|
|
174
173
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|