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 #
|
@@ -94,11 +94,6 @@ module Tinkerforge
|
|
94
94
|
@response_expected[FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
95
95
|
@response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
|
96
96
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
97
|
-
@response_expected[CALLBACK_CURRENT] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
98
|
-
@response_expected[CALLBACK_ANALOG_VALUE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
99
|
-
@response_expected[CALLBACK_CURRENT_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
100
|
-
@response_expected[CALLBACK_ANALOG_VALUE_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
101
|
-
@response_expected[CALLBACK_OVER_CURRENT] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
102
97
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
103
98
|
|
104
99
|
@callback_formats[CALLBACK_CURRENT] = 's'
|
@@ -106,6 +101,7 @@ module Tinkerforge
|
|
106
101
|
@callback_formats[CALLBACK_CURRENT_REACHED] = 's'
|
107
102
|
@callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
|
108
103
|
@callback_formats[CALLBACK_OVER_CURRENT] = ''
|
104
|
+
|
109
105
|
end
|
110
106
|
|
111
107
|
# Returns the current of the sensor. The value is in mA
|
@@ -115,7 +111,7 @@ module Tinkerforge
|
|
115
111
|
# CALLBACK_CURRENT callback and set the period with
|
116
112
|
# BrickletCurrent12#set_current_callback_period.
|
117
113
|
def get_current
|
118
|
-
send_request
|
114
|
+
send_request FUNCTION_GET_CURRENT, [], '', 2, 's'
|
119
115
|
end
|
120
116
|
|
121
117
|
# Calibrates the 0 value of the sensor. You have to call this function
|
@@ -130,7 +126,7 @@ module Tinkerforge
|
|
130
126
|
# The resulting calibration will be saved on the EEPROM of the Current
|
131
127
|
# Bricklet.
|
132
128
|
def calibrate
|
133
|
-
send_request
|
129
|
+
send_request FUNCTION_CALIBRATE, [], '', 0, ''
|
134
130
|
end
|
135
131
|
|
136
132
|
# Returns *true* if more than 12.5A were measured.
|
@@ -138,7 +134,7 @@ module Tinkerforge
|
|
138
134
|
# .. note::
|
139
135
|
# To reset this value you have to power cycle the Bricklet.
|
140
136
|
def is_over_current
|
141
|
-
send_request
|
137
|
+
send_request FUNCTION_IS_OVER_CURRENT, [], '', 1, '?'
|
142
138
|
end
|
143
139
|
|
144
140
|
# Returns the value as read by a 12-bit analog-to-digital converter.
|
@@ -154,7 +150,7 @@ module Tinkerforge
|
|
154
150
|
# CALLBACK_ANALOG_VALUE callback and set the period with
|
155
151
|
# BrickletCurrent12#set_analog_value_callback_period.
|
156
152
|
def get_analog_value
|
157
|
-
send_request
|
153
|
+
send_request FUNCTION_GET_ANALOG_VALUE, [], '', 2, 'S'
|
158
154
|
end
|
159
155
|
|
160
156
|
# Sets the period in ms with which the CALLBACK_CURRENT callback is triggered
|
@@ -165,12 +161,12 @@ module Tinkerforge
|
|
165
161
|
#
|
166
162
|
# The default value is 0.
|
167
163
|
def set_current_callback_period(period)
|
168
|
-
send_request
|
164
|
+
send_request FUNCTION_SET_CURRENT_CALLBACK_PERIOD, [period], 'L', 0, ''
|
169
165
|
end
|
170
166
|
|
171
167
|
# Returns the period as set by BrickletCurrent12#set_current_callback_period.
|
172
168
|
def get_current_callback_period
|
173
|
-
send_request
|
169
|
+
send_request FUNCTION_GET_CURRENT_CALLBACK_PERIOD, [], '', 4, 'L'
|
174
170
|
end
|
175
171
|
|
176
172
|
# Sets the period in ms with which the CALLBACK_ANALOG_VALUE callback is triggered
|
@@ -181,12 +177,12 @@ module Tinkerforge
|
|
181
177
|
#
|
182
178
|
# The default value is 0.
|
183
179
|
def set_analog_value_callback_period(period)
|
184
|
-
send_request
|
180
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
185
181
|
end
|
186
182
|
|
187
183
|
# Returns the period as set by BrickletCurrent12#set_analog_value_callback_period.
|
188
184
|
def get_analog_value_callback_period
|
189
|
-
send_request
|
185
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L'
|
190
186
|
end
|
191
187
|
|
192
188
|
# Sets the thresholds for the CALLBACK_CURRENT_REACHED callback.
|
@@ -203,12 +199,12 @@ module Tinkerforge
|
|
203
199
|
#
|
204
200
|
# The default value is ('x', 0, 0).
|
205
201
|
def set_current_callback_threshold(option, min, max)
|
206
|
-
send_request
|
202
|
+
send_request FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 0, ''
|
207
203
|
end
|
208
204
|
|
209
205
|
# Returns the threshold as set by BrickletCurrent12#set_current_callback_threshold.
|
210
206
|
def get_current_callback_threshold
|
211
|
-
send_request
|
207
|
+
send_request FUNCTION_GET_CURRENT_CALLBACK_THRESHOLD, [], '', 5, 'k s s'
|
212
208
|
end
|
213
209
|
|
214
210
|
# Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
|
@@ -225,12 +221,12 @@ module Tinkerforge
|
|
225
221
|
#
|
226
222
|
# The default value is ('x', 0, 0).
|
227
223
|
def set_analog_value_callback_threshold(option, min, max)
|
228
|
-
send_request
|
224
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
|
229
225
|
end
|
230
226
|
|
231
227
|
# Returns the threshold as set by BrickletCurrent12#set_analog_value_callback_threshold.
|
232
228
|
def get_analog_value_callback_threshold
|
233
|
-
send_request
|
229
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
|
234
230
|
end
|
235
231
|
|
236
232
|
# Sets the period in ms with which the threshold callbacks
|
@@ -247,12 +243,12 @@ module Tinkerforge
|
|
247
243
|
#
|
248
244
|
# The default value is 100.
|
249
245
|
def set_debounce_period(debounce)
|
250
|
-
send_request
|
246
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
251
247
|
end
|
252
248
|
|
253
249
|
# Returns the debounce period as set by BrickletCurrent12#set_debounce_period.
|
254
250
|
def get_debounce_period
|
255
|
-
send_request
|
251
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
256
252
|
end
|
257
253
|
|
258
254
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -264,7 +260,7 @@ module Tinkerforge
|
|
264
260
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
265
261
|
# |device_identifier_constant|
|
266
262
|
def get_identity
|
267
|
-
send_request
|
263
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
268
264
|
end
|
269
265
|
|
270
266
|
# 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 #
|
@@ -94,11 +94,6 @@ module Tinkerforge
|
|
94
94
|
@response_expected[FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
95
95
|
@response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
|
96
96
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
97
|
-
@response_expected[CALLBACK_CURRENT] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
98
|
-
@response_expected[CALLBACK_ANALOG_VALUE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
99
|
-
@response_expected[CALLBACK_CURRENT_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
100
|
-
@response_expected[CALLBACK_ANALOG_VALUE_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
101
|
-
@response_expected[CALLBACK_OVER_CURRENT] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
102
97
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
103
98
|
|
104
99
|
@callback_formats[CALLBACK_CURRENT] = 's'
|
@@ -106,6 +101,7 @@ module Tinkerforge
|
|
106
101
|
@callback_formats[CALLBACK_CURRENT_REACHED] = 's'
|
107
102
|
@callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
|
108
103
|
@callback_formats[CALLBACK_OVER_CURRENT] = ''
|
104
|
+
|
109
105
|
end
|
110
106
|
|
111
107
|
# Returns the current of the sensor. The value is in mA
|
@@ -115,7 +111,7 @@ module Tinkerforge
|
|
115
111
|
# CALLBACK_CURRENT callback and set the period with
|
116
112
|
# BrickletCurrent25#set_current_callback_period.
|
117
113
|
def get_current
|
118
|
-
send_request
|
114
|
+
send_request FUNCTION_GET_CURRENT, [], '', 2, 's'
|
119
115
|
end
|
120
116
|
|
121
117
|
# Calibrates the 0 value of the sensor. You have to call this function
|
@@ -130,7 +126,7 @@ module Tinkerforge
|
|
130
126
|
# The resulting calibration will be saved on the EEPROM of the Current
|
131
127
|
# Bricklet.
|
132
128
|
def calibrate
|
133
|
-
send_request
|
129
|
+
send_request FUNCTION_CALIBRATE, [], '', 0, ''
|
134
130
|
end
|
135
131
|
|
136
132
|
# Returns *true* if more than 25A were measured.
|
@@ -138,7 +134,7 @@ module Tinkerforge
|
|
138
134
|
# .. note::
|
139
135
|
# To reset this value you have to power cycle the Bricklet.
|
140
136
|
def is_over_current
|
141
|
-
send_request
|
137
|
+
send_request FUNCTION_IS_OVER_CURRENT, [], '', 1, '?'
|
142
138
|
end
|
143
139
|
|
144
140
|
# Returns the value as read by a 12-bit analog-to-digital converter.
|
@@ -154,7 +150,7 @@ module Tinkerforge
|
|
154
150
|
# CALLBACK_ANALOG_VALUE callback and set the period with
|
155
151
|
# BrickletCurrent25#set_analog_value_callback_period.
|
156
152
|
def get_analog_value
|
157
|
-
send_request
|
153
|
+
send_request FUNCTION_GET_ANALOG_VALUE, [], '', 2, 'S'
|
158
154
|
end
|
159
155
|
|
160
156
|
# Sets the period in ms with which the CALLBACK_CURRENT callback is triggered
|
@@ -165,12 +161,12 @@ module Tinkerforge
|
|
165
161
|
#
|
166
162
|
# The default value is 0.
|
167
163
|
def set_current_callback_period(period)
|
168
|
-
send_request
|
164
|
+
send_request FUNCTION_SET_CURRENT_CALLBACK_PERIOD, [period], 'L', 0, ''
|
169
165
|
end
|
170
166
|
|
171
167
|
# Returns the period as set by BrickletCurrent25#set_current_callback_period.
|
172
168
|
def get_current_callback_period
|
173
|
-
send_request
|
169
|
+
send_request FUNCTION_GET_CURRENT_CALLBACK_PERIOD, [], '', 4, 'L'
|
174
170
|
end
|
175
171
|
|
176
172
|
# Sets the period in ms with which the CALLBACK_ANALOG_VALUE callback is triggered
|
@@ -181,12 +177,12 @@ module Tinkerforge
|
|
181
177
|
#
|
182
178
|
# The default value is 0.
|
183
179
|
def set_analog_value_callback_period(period)
|
184
|
-
send_request
|
180
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
185
181
|
end
|
186
182
|
|
187
183
|
# Returns the period as set by BrickletCurrent25#set_analog_value_callback_period.
|
188
184
|
def get_analog_value_callback_period
|
189
|
-
send_request
|
185
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L'
|
190
186
|
end
|
191
187
|
|
192
188
|
# Sets the thresholds for the CALLBACK_CURRENT_REACHED callback.
|
@@ -203,12 +199,12 @@ module Tinkerforge
|
|
203
199
|
#
|
204
200
|
# The default value is ('x', 0, 0).
|
205
201
|
def set_current_callback_threshold(option, min, max)
|
206
|
-
send_request
|
202
|
+
send_request FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD, [option, min, max], 'k s s', 0, ''
|
207
203
|
end
|
208
204
|
|
209
205
|
# Returns the threshold as set by BrickletCurrent25#set_current_callback_threshold.
|
210
206
|
def get_current_callback_threshold
|
211
|
-
send_request
|
207
|
+
send_request FUNCTION_GET_CURRENT_CALLBACK_THRESHOLD, [], '', 5, 'k s s'
|
212
208
|
end
|
213
209
|
|
214
210
|
# Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
|
@@ -225,12 +221,12 @@ module Tinkerforge
|
|
225
221
|
#
|
226
222
|
# The default value is ('x', 0, 0).
|
227
223
|
def set_analog_value_callback_threshold(option, min, max)
|
228
|
-
send_request
|
224
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
|
229
225
|
end
|
230
226
|
|
231
227
|
# Returns the threshold as set by BrickletCurrent25#set_analog_value_callback_threshold.
|
232
228
|
def get_analog_value_callback_threshold
|
233
|
-
send_request
|
229
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
|
234
230
|
end
|
235
231
|
|
236
232
|
# Sets the period in ms with which the threshold callbacks
|
@@ -247,12 +243,12 @@ module Tinkerforge
|
|
247
243
|
#
|
248
244
|
# The default value is 100.
|
249
245
|
def set_debounce_period(debounce)
|
250
|
-
send_request
|
246
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
251
247
|
end
|
252
248
|
|
253
249
|
# Returns the debounce period as set by BrickletCurrent25#set_debounce_period.
|
254
250
|
def get_debounce_period
|
255
|
-
send_request
|
251
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
256
252
|
end
|
257
253
|
|
258
254
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -264,7 +260,7 @@ module Tinkerforge
|
|
264
260
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
265
261
|
# |device_identifier_constant|
|
266
262
|
def get_identity
|
267
|
-
send_request
|
263
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
268
264
|
end
|
269
265
|
|
270
266
|
# 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 #
|
@@ -90,16 +90,13 @@ module Tinkerforge
|
|
90
90
|
@response_expected[FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
91
91
|
@response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
|
92
92
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
93
|
-
@response_expected[CALLBACK_DISTANCE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
94
|
-
@response_expected[CALLBACK_ANALOG_VALUE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
95
|
-
@response_expected[CALLBACK_DISTANCE_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
96
|
-
@response_expected[CALLBACK_ANALOG_VALUE_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
97
93
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
98
94
|
|
99
95
|
@callback_formats[CALLBACK_DISTANCE] = 'S'
|
100
96
|
@callback_formats[CALLBACK_ANALOG_VALUE] = 'S'
|
101
97
|
@callback_formats[CALLBACK_DISTANCE_REACHED] = 'S'
|
102
98
|
@callback_formats[CALLBACK_ANALOG_VALUE_REACHED] = 'S'
|
99
|
+
|
103
100
|
end
|
104
101
|
|
105
102
|
# Returns the distance measured by the sensor. The value is in mm and possible
|
@@ -110,7 +107,7 @@ module Tinkerforge
|
|
110
107
|
# CALLBACK_DISTANCE callback and set the period with
|
111
108
|
# BrickletDistanceIR#set_distance_callback_period.
|
112
109
|
def get_distance
|
113
|
-
send_request
|
110
|
+
send_request FUNCTION_GET_DISTANCE, [], '', 2, 'S'
|
114
111
|
end
|
115
112
|
|
116
113
|
# Returns the value as read by a 12-bit analog-to-digital converter.
|
@@ -126,7 +123,7 @@ module Tinkerforge
|
|
126
123
|
# CALLBACK_ANALOG_VALUE callback and set the period with
|
127
124
|
# BrickletDistanceIR#set_analog_value_callback_period.
|
128
125
|
def get_analog_value
|
129
|
-
send_request
|
126
|
+
send_request FUNCTION_GET_ANALOG_VALUE, [], '', 2, 'S'
|
130
127
|
end
|
131
128
|
|
132
129
|
# Sets a sampling point value to a specific position of the lookup table.
|
@@ -148,13 +145,13 @@ module Tinkerforge
|
|
148
145
|
# implemented in the Brick Viewer. If you want to calibrate your Bricklet it is
|
149
146
|
# highly recommended to use this implementation.
|
150
147
|
def set_sampling_point(position, distance)
|
151
|
-
send_request
|
148
|
+
send_request FUNCTION_SET_SAMPLING_POINT, [position, distance], 'C S', 0, ''
|
152
149
|
end
|
153
150
|
|
154
151
|
# Returns the distance to a sampling point position as set by
|
155
152
|
# BrickletDistanceIR#set_sampling_point.
|
156
153
|
def get_sampling_point(position)
|
157
|
-
send_request
|
154
|
+
send_request FUNCTION_GET_SAMPLING_POINT, [position], 'C', 2, 'S'
|
158
155
|
end
|
159
156
|
|
160
157
|
# Sets the period in ms with which the CALLBACK_DISTANCE callback is triggered
|
@@ -165,12 +162,12 @@ module Tinkerforge
|
|
165
162
|
#
|
166
163
|
# The default value is 0.
|
167
164
|
def set_distance_callback_period(period)
|
168
|
-
send_request
|
165
|
+
send_request FUNCTION_SET_DISTANCE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
169
166
|
end
|
170
167
|
|
171
168
|
# Returns the period as set by BrickletDistanceIR#set_distance_callback_period.
|
172
169
|
def get_distance_callback_period
|
173
|
-
send_request
|
170
|
+
send_request FUNCTION_GET_DISTANCE_CALLBACK_PERIOD, [], '', 4, 'L'
|
174
171
|
end
|
175
172
|
|
176
173
|
# Sets the period in ms with which the CALLBACK_ANALOG_VALUE callback is triggered
|
@@ -181,12 +178,12 @@ module Tinkerforge
|
|
181
178
|
#
|
182
179
|
# The default value is 0.
|
183
180
|
def set_analog_value_callback_period(period)
|
184
|
-
send_request
|
181
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
185
182
|
end
|
186
183
|
|
187
184
|
# Returns the period as set by BrickletDistanceIR#set_analog_value_callback_period.
|
188
185
|
def get_analog_value_callback_period
|
189
|
-
send_request
|
186
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD, [], '', 4, 'L'
|
190
187
|
end
|
191
188
|
|
192
189
|
# Sets the thresholds for the CALLBACK_DISTANCE_REACHED callback.
|
@@ -203,12 +200,12 @@ module Tinkerforge
|
|
203
200
|
#
|
204
201
|
# The default value is ('x', 0, 0).
|
205
202
|
def set_distance_callback_threshold(option, min, max)
|
206
|
-
send_request
|
203
|
+
send_request FUNCTION_SET_DISTANCE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
|
207
204
|
end
|
208
205
|
|
209
206
|
# Returns the threshold as set by BrickletDistanceIR#set_distance_callback_threshold.
|
210
207
|
def get_distance_callback_threshold
|
211
|
-
send_request
|
208
|
+
send_request FUNCTION_GET_DISTANCE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
|
212
209
|
end
|
213
210
|
|
214
211
|
# Sets the thresholds for the CALLBACK_ANALOG_VALUE_REACHED callback.
|
@@ -225,12 +222,12 @@ module Tinkerforge
|
|
225
222
|
#
|
226
223
|
# The default value is ('x', 0, 0).
|
227
224
|
def set_analog_value_callback_threshold(option, min, max)
|
228
|
-
send_request
|
225
|
+
send_request FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
|
229
226
|
end
|
230
227
|
|
231
228
|
# Returns the threshold as set by BrickletDistanceIR#set_analog_value_callback_threshold.
|
232
229
|
def get_analog_value_callback_threshold
|
233
|
-
send_request
|
230
|
+
send_request FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
|
234
231
|
end
|
235
232
|
|
236
233
|
# Sets the period in ms with which the threshold callbacks
|
@@ -247,12 +244,12 @@ module Tinkerforge
|
|
247
244
|
#
|
248
245
|
# The default value is 100.
|
249
246
|
def set_debounce_period(debounce)
|
250
|
-
send_request
|
247
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
251
248
|
end
|
252
249
|
|
253
250
|
# Returns the debounce period as set by BrickletDistanceIR#set_debounce_period.
|
254
251
|
def get_debounce_period
|
255
|
-
send_request
|
252
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
256
253
|
end
|
257
254
|
|
258
255
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -264,7 +261,7 @@ module Tinkerforge
|
|
264
261
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
265
262
|
# |device_identifier_constant|
|
266
263
|
def get_identity
|
267
|
-
send_request
|
264
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
268
265
|
end
|
269
266
|
|
270
267
|
# 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_DISTANCE_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_DISTANCE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
66
|
-
@response_expected[CALLBACK_DISTANCE_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_DISTANCE] = 'S'
|
72
70
|
@callback_formats[CALLBACK_DISTANCE_REACHED] = 'S'
|
71
|
+
|
73
72
|
end
|
74
73
|
|
75
74
|
# Returns the current distance value measured by the sensor. The value has a
|
@@ -83,7 +82,7 @@ module Tinkerforge
|
|
83
82
|
# use the CALLBACK_DISTANCE callback and set the period with
|
84
83
|
# BrickletDistanceUS#set_distance_callback_period.
|
85
84
|
def get_distance_value
|
86
|
-
send_request
|
85
|
+
send_request FUNCTION_GET_DISTANCE_VALUE, [], '', 2, 'S'
|
87
86
|
end
|
88
87
|
|
89
88
|
# Sets the period in ms with which the CALLBACK_DISTANCE callback is triggered
|
@@ -94,12 +93,12 @@ module Tinkerforge
|
|
94
93
|
#
|
95
94
|
# The default value is 0.
|
96
95
|
def set_distance_callback_period(period)
|
97
|
-
send_request
|
96
|
+
send_request FUNCTION_SET_DISTANCE_CALLBACK_PERIOD, [period], 'L', 0, ''
|
98
97
|
end
|
99
98
|
|
100
99
|
# Returns the period as set by BrickletDistanceUS#set_distance_callback_period.
|
101
100
|
def get_distance_callback_period
|
102
|
-
send_request
|
101
|
+
send_request FUNCTION_GET_DISTANCE_CALLBACK_PERIOD, [], '', 4, 'L'
|
103
102
|
end
|
104
103
|
|
105
104
|
# Sets the thresholds for the CALLBACK_DISTANCE_REACHED callback.
|
@@ -116,12 +115,12 @@ module Tinkerforge
|
|
116
115
|
#
|
117
116
|
# The default value is ('x', 0, 0).
|
118
117
|
def set_distance_callback_threshold(option, min, max)
|
119
|
-
send_request
|
118
|
+
send_request FUNCTION_SET_DISTANCE_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 0, ''
|
120
119
|
end
|
121
120
|
|
122
121
|
# Returns the threshold as set by BrickletDistanceUS#set_distance_callback_threshold.
|
123
122
|
def get_distance_callback_threshold
|
124
|
-
send_request
|
123
|
+
send_request FUNCTION_GET_DISTANCE_CALLBACK_THRESHOLD, [], '', 5, 'k S S'
|
125
124
|
end
|
126
125
|
|
127
126
|
# Sets the period in ms with which the threshold callbacks
|
@@ -136,12 +135,12 @@ module Tinkerforge
|
|
136
135
|
#
|
137
136
|
# The default value is 100.
|
138
137
|
def set_debounce_period(debounce)
|
139
|
-
send_request
|
138
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, ''
|
140
139
|
end
|
141
140
|
|
142
141
|
# Returns the debounce period as set by BrickletDistanceUS#set_debounce_period.
|
143
142
|
def get_debounce_period
|
144
|
-
send_request
|
143
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L'
|
145
144
|
end
|
146
145
|
|
147
146
|
# Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
|
@@ -154,12 +153,12 @@ module Tinkerforge
|
|
154
153
|
#
|
155
154
|
# The default value is 20.
|
156
155
|
def set_moving_average(average)
|
157
|
-
send_request
|
156
|
+
send_request FUNCTION_SET_MOVING_AVERAGE, [average], 'C', 0, ''
|
158
157
|
end
|
159
158
|
|
160
159
|
# Returns the length moving average as set by BrickletDistanceUS#set_moving_average.
|
161
160
|
def get_moving_average
|
162
|
-
send_request
|
161
|
+
send_request FUNCTION_GET_MOVING_AVERAGE, [], '', 1, 'C'
|
163
162
|
end
|
164
163
|
|
165
164
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -171,7 +170,7 @@ module Tinkerforge
|
|
171
170
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
172
171
|
# |device_identifier_constant|
|
173
172
|
def get_identity
|
174
|
-
send_request
|
173
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
175
174
|
end
|
176
175
|
|
177
176
|
# 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,11 +55,11 @@ module Tinkerforge
|
|
55
55
|
@response_expected[FUNCTION_SET_LED_STATE] = RESPONSE_EXPECTED_FALSE
|
56
56
|
@response_expected[FUNCTION_GET_LED_STATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
57
57
|
@response_expected[FUNCTION_GET_BUTTON_STATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
58
|
-
@response_expected[CALLBACK_STATE_CHANGED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
59
58
|
@response_expected[FUNCTION_SET_SELECTED_LED_STATE] = RESPONSE_EXPECTED_FALSE
|
60
59
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
61
60
|
|
62
61
|
@callback_formats[CALLBACK_STATE_CHANGED] = 'C C C C'
|
62
|
+
|
63
63
|
end
|
64
64
|
|
65
65
|
# Sets the state of the LEDs. Possible states are:
|
@@ -77,12 +77,12 @@ module Tinkerforge
|
|
77
77
|
#
|
78
78
|
# The default value is (1, 1).
|
79
79
|
def set_led_state(led_l, led_r)
|
80
|
-
send_request
|
80
|
+
send_request FUNCTION_SET_LED_STATE, [led_l, led_r], 'C C', 0, ''
|
81
81
|
end
|
82
82
|
|
83
83
|
# Returns the current state of the LEDs, as set by BrickletDualButton#set_led_state.
|
84
84
|
def get_led_state
|
85
|
-
send_request
|
85
|
+
send_request FUNCTION_GET_LED_STATE, [], '', 2, 'C C'
|
86
86
|
end
|
87
87
|
|
88
88
|
# Returns the current state for both buttons. Possible states are:
|
@@ -90,14 +90,14 @@ module Tinkerforge
|
|
90
90
|
# * 0 = pressed
|
91
91
|
# * 1 = released
|
92
92
|
def get_button_state
|
93
|
-
send_request
|
93
|
+
send_request FUNCTION_GET_BUTTON_STATE, [], '', 2, 'C C'
|
94
94
|
end
|
95
95
|
|
96
96
|
# Sets the state of the selected LED (0 or 1).
|
97
97
|
#
|
98
98
|
# The other LED remains untouched.
|
99
99
|
def set_selected_led_state(led, state)
|
100
|
-
send_request
|
100
|
+
send_request FUNCTION_SET_SELECTED_LED_STATE, [led, state], 'C C', 0, ''
|
101
101
|
end
|
102
102
|
|
103
103
|
# Returns the UID, the UID where the Bricklet is connected to,
|
@@ -109,7 +109,7 @@ module Tinkerforge
|
|
109
109
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
110
110
|
# |device_identifier_constant|
|
111
111
|
def get_identity
|
112
|
-
send_request
|
112
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
|
113
113
|
end
|
114
114
|
|
115
115
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|