tinkerforge 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/tinkerforge/brick_dc.rb +2 -2
- data/lib/tinkerforge/brick_imu.rb +2 -2
- data/lib/tinkerforge/brick_master.rb +2 -2
- data/lib/tinkerforge/brick_servo.rb +2 -2
- data/lib/tinkerforge/brick_stepper.rb +2 -2
- data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_in.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
- data/lib/tinkerforge/bricklet_barometer.rb +2 -2
- data/lib/tinkerforge/bricklet_color.rb +325 -0
- data/lib/tinkerforge/bricklet_current12.rb +2 -2
- data/lib/tinkerforge/bricklet_current25.rb +2 -2
- data/lib/tinkerforge/bricklet_distance_ir.rb +2 -2
- data/lib/tinkerforge/bricklet_distance_us.rb +2 -2
- data/lib/tinkerforge/bricklet_dual_button.rb +2 -2
- data/lib/tinkerforge/bricklet_dual_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_gps.rb +2 -2
- data/lib/tinkerforge/bricklet_hall_effect.rb +2 -2
- data/lib/tinkerforge/bricklet_humidity.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_io16.rb +4 -2
- data/lib/tinkerforge/bricklet_io4.rb +4 -2
- data/lib/tinkerforge/bricklet_joystick.rb +2 -2
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +2 -2
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +2 -2
- data/lib/tinkerforge/bricklet_led_strip.rb +2 -2
- data/lib/tinkerforge/bricklet_line.rb +2 -2
- data/lib/tinkerforge/bricklet_linear_poti.rb +2 -2
- data/lib/tinkerforge/bricklet_moisture.rb +2 -2
- data/lib/tinkerforge/bricklet_motion_detector.rb +2 -2
- data/lib/tinkerforge/bricklet_multi_touch.rb +2 -2
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +222 -0
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +2 -2
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +2 -2
- data/lib/tinkerforge/bricklet_ptc.rb +2 -2
- data/lib/tinkerforge/bricklet_remote_switch.rb +2 -2
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +2 -2
- data/lib/tinkerforge/bricklet_rotary_poti.rb +2 -2
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +103 -0
- data/lib/tinkerforge/bricklet_sound_intensity.rb +2 -2
- data/lib/tinkerforge/bricklet_temperature.rb +2 -2
- data/lib/tinkerforge/bricklet_temperature_ir.rb +2 -2
- data/lib/tinkerforge/bricklet_tilt.rb +2 -2
- data/lib/tinkerforge/bricklet_voltage.rb +2 -2
- data/lib/tinkerforge/bricklet_voltage_current.rb +2 -2
- data/lib/tinkerforge/version.rb +1 -1
- metadata +6 -3
data/lib/tinkerforge/brick_dc.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
|
2
|
+
#############################################################
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
|
+
# #
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
6
|
+
# #
|
|
7
|
+
# If you have a bugfix for this file and want to commit it, #
|
|
8
|
+
# please fix the bug in the generator. You can find a link #
|
|
9
|
+
# to the generator git on tinkerforge.com #
|
|
10
|
+
#############################################################
|
|
11
|
+
|
|
12
|
+
module Tinkerforge
|
|
13
|
+
# Device for measuring color (RGB value), illuminance and color temperature
|
|
14
|
+
class BrickletColor < Device
|
|
15
|
+
DEVICE_IDENTIFIER = 243 # :nodoc:
|
|
16
|
+
|
|
17
|
+
# This callback is triggered periodically with the period that is set by
|
|
18
|
+
# BrickletColor#set_color_callback_period. The parameter is the color
|
|
19
|
+
# of the sensor as RGBC.
|
|
20
|
+
#
|
|
21
|
+
# CALLBACK_COLOR is only triggered if the color has changed since the
|
|
22
|
+
# last triggering.
|
|
23
|
+
CALLBACK_COLOR = 8
|
|
24
|
+
|
|
25
|
+
# This callback is triggered periodically with the period that is set by
|
|
26
|
+
# BrickletColor#set_color_callback_period. The parameter is the color
|
|
27
|
+
# of the sensor as RGBC.
|
|
28
|
+
#
|
|
29
|
+
# CALLBACK_COLOR is only triggered if the color has changed since the
|
|
30
|
+
# last triggering.
|
|
31
|
+
CALLBACK_COLOR_REACHED = 9
|
|
32
|
+
|
|
33
|
+
# This callback is triggered periodically with the period that is set by
|
|
34
|
+
# BrickletColor#set_illuminance_callback_period. The parameter is the illuminance.
|
|
35
|
+
# See BrickletColor#get_illuminance for how to interrept this value.
|
|
36
|
+
#
|
|
37
|
+
# CALLBACK_ILLUMINANCE is only triggered if the illuminance has changed since the
|
|
38
|
+
# last triggering.
|
|
39
|
+
CALLBACK_ILLUMINANCE = 21
|
|
40
|
+
|
|
41
|
+
# This callback is triggered periodically with the period that is set by
|
|
42
|
+
# BrickletColor#set_color_temperature_callback_period. The parameter is the
|
|
43
|
+
# color temperature in Kelvin.
|
|
44
|
+
#
|
|
45
|
+
# CALLBACK_COLOR_TEMPERATURE is only triggered if the color temperature has
|
|
46
|
+
# changed since the last triggering.
|
|
47
|
+
CALLBACK_COLOR_TEMPERATURE = 22
|
|
48
|
+
|
|
49
|
+
FUNCTION_GET_COLOR = 1 # :nodoc:
|
|
50
|
+
FUNCTION_SET_COLOR_CALLBACK_PERIOD = 2 # :nodoc:
|
|
51
|
+
FUNCTION_GET_COLOR_CALLBACK_PERIOD = 3 # :nodoc:
|
|
52
|
+
FUNCTION_SET_COLOR_CALLBACK_THRESHOLD = 4 # :nodoc:
|
|
53
|
+
FUNCTION_GET_COLOR_CALLBACK_THRESHOLD = 5 # :nodoc:
|
|
54
|
+
FUNCTION_SET_DEBOUNCE_PERIOD = 6 # :nodoc:
|
|
55
|
+
FUNCTION_GET_DEBOUNCE_PERIOD = 7 # :nodoc:
|
|
56
|
+
FUNCTION_LIGHT_ON = 10 # :nodoc:
|
|
57
|
+
FUNCTION_LIGHT_OFF = 11 # :nodoc:
|
|
58
|
+
FUNCTION_IS_LIGHT_ON = 12 # :nodoc:
|
|
59
|
+
FUNCTION_SET_CONFIG = 13 # :nodoc:
|
|
60
|
+
FUNCTION_GET_CONFIG = 14 # :nodoc:
|
|
61
|
+
FUNCTION_GET_ILLUMINANCE = 15 # :nodoc:
|
|
62
|
+
FUNCTION_GET_COLOR_TEMPERATURE = 16 # :nodoc:
|
|
63
|
+
FUNCTION_SET_ILLUMINANCE_CALLBACK_PERIOD = 17 # :nodoc:
|
|
64
|
+
FUNCTION_GET_ILLUMINANCE_CALLBACK_PERIOD = 18 # :nodoc:
|
|
65
|
+
FUNCTION_SET_COLOR_TEMPERATURE_CALLBACK_PERIOD = 19 # :nodoc:
|
|
66
|
+
FUNCTION_GET_COLOR_TEMPERATURE_CALLBACK_PERIOD = 20 # :nodoc:
|
|
67
|
+
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
|
68
|
+
|
|
69
|
+
THRESHOLD_OPTION_OFF = 'x' # :nodoc:
|
|
70
|
+
THRESHOLD_OPTION_OUTSIDE = 'o' # :nodoc:
|
|
71
|
+
THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
|
|
72
|
+
THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
|
|
73
|
+
THRESHOLD_OPTION_GREATER = '>' # :nodoc:
|
|
74
|
+
LIGHT_ON = 0 # :nodoc:
|
|
75
|
+
LIGHT_OFF = 1 # :nodoc:
|
|
76
|
+
GAIN_1X = 0 # :nodoc:
|
|
77
|
+
GAIN_4X = 1 # :nodoc:
|
|
78
|
+
GAIN_16X = 2 # :nodoc:
|
|
79
|
+
GAIN_60X = 3 # :nodoc:
|
|
80
|
+
INTEGRATION_TIME_2MS = 0 # :nodoc:
|
|
81
|
+
INTEGRATION_TIME_24MS = 1 # :nodoc:
|
|
82
|
+
INTEGRATION_TIME_101MS = 2 # :nodoc:
|
|
83
|
+
INTEGRATION_TIME_154MS = 3 # :nodoc:
|
|
84
|
+
INTEGRATION_TIME_700MS = 4 # :nodoc:
|
|
85
|
+
|
|
86
|
+
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
87
|
+
# the IP Connection <tt>ipcon</tt>.
|
|
88
|
+
def initialize(uid, ipcon)
|
|
89
|
+
super uid, ipcon
|
|
90
|
+
|
|
91
|
+
@api_version = [2, 0, 0]
|
|
92
|
+
|
|
93
|
+
@response_expected[FUNCTION_GET_COLOR] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
94
|
+
@response_expected[FUNCTION_SET_COLOR_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
|
|
95
|
+
@response_expected[FUNCTION_GET_COLOR_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
96
|
+
@response_expected[FUNCTION_SET_COLOR_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_TRUE
|
|
97
|
+
@response_expected[FUNCTION_GET_COLOR_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
98
|
+
@response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
|
|
99
|
+
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
100
|
+
@response_expected[CALLBACK_COLOR] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
101
|
+
@response_expected[CALLBACK_COLOR_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
102
|
+
@response_expected[FUNCTION_LIGHT_ON] = RESPONSE_EXPECTED_FALSE
|
|
103
|
+
@response_expected[FUNCTION_LIGHT_OFF] = RESPONSE_EXPECTED_FALSE
|
|
104
|
+
@response_expected[FUNCTION_IS_LIGHT_ON] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
105
|
+
@response_expected[FUNCTION_SET_CONFIG] = RESPONSE_EXPECTED_FALSE
|
|
106
|
+
@response_expected[FUNCTION_GET_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
107
|
+
@response_expected[FUNCTION_GET_ILLUMINANCE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
108
|
+
@response_expected[FUNCTION_GET_COLOR_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
109
|
+
@response_expected[FUNCTION_SET_ILLUMINANCE_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
|
|
110
|
+
@response_expected[FUNCTION_GET_ILLUMINANCE_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
111
|
+
@response_expected[FUNCTION_SET_COLOR_TEMPERATURE_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
|
|
112
|
+
@response_expected[FUNCTION_GET_COLOR_TEMPERATURE_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
113
|
+
@response_expected[CALLBACK_ILLUMINANCE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
114
|
+
@response_expected[CALLBACK_COLOR_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
115
|
+
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
116
|
+
|
|
117
|
+
@callback_formats[CALLBACK_COLOR] = 'S S S S'
|
|
118
|
+
@callback_formats[CALLBACK_COLOR_REACHED] = 'S S S S'
|
|
119
|
+
@callback_formats[CALLBACK_ILLUMINANCE] = 'L'
|
|
120
|
+
@callback_formats[CALLBACK_COLOR_TEMPERATURE] = 'S'
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Returns the measured color of the sensor. The values
|
|
124
|
+
# have a range of 0 to 65535.
|
|
125
|
+
#
|
|
126
|
+
# The red (r), green (g), blue (b) and clear (c) colors are measured
|
|
127
|
+
# with four different photodiodes that are responsive at different
|
|
128
|
+
# wavelengths:
|
|
129
|
+
#
|
|
130
|
+
# .. image:: /Images/Bricklets/bricklet_color_wavelength_chart_600.jpg
|
|
131
|
+
# :scale: 100 %
|
|
132
|
+
# :alt: Chart Responsivity / Wavelength
|
|
133
|
+
# :align: center
|
|
134
|
+
# :target: ../../_images/Bricklets/bricklet_color_wavelength_chart_600.jpg
|
|
135
|
+
#
|
|
136
|
+
# If you want to get the color periodically, it is recommended
|
|
137
|
+
# to use the callback CALLBACK_COLOR and set the period with
|
|
138
|
+
# BrickletColor#set_color_callback_period.
|
|
139
|
+
def get_color
|
|
140
|
+
send_request(FUNCTION_GET_COLOR, [], '', 8, 'S S S S')
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Sets the period in ms with which the CALLBACK_COLOR callback is triggered
|
|
144
|
+
# periodically. A value of 0 turns the callback off.
|
|
145
|
+
#
|
|
146
|
+
# CALLBACK_COLOR is only triggered if the color has changed since the
|
|
147
|
+
# last triggering.
|
|
148
|
+
#
|
|
149
|
+
# The default value is 0.
|
|
150
|
+
def set_color_callback_period(period)
|
|
151
|
+
send_request(FUNCTION_SET_COLOR_CALLBACK_PERIOD, [period], 'L', 0, '')
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Returns the period as set by BrickletColor#set_color_callback_period.
|
|
155
|
+
def get_color_callback_period
|
|
156
|
+
send_request(FUNCTION_GET_COLOR_CALLBACK_PERIOD, [], '', 4, 'L')
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Sets the thresholds for the CALLBACK_COLOR_REACHED callback.
|
|
160
|
+
#
|
|
161
|
+
# The following options are possible:
|
|
162
|
+
#
|
|
163
|
+
# "Option", "Description"
|
|
164
|
+
#
|
|
165
|
+
# "'x'", "Callback is turned off"
|
|
166
|
+
# "'o'", "Callback is triggered when the temperature is *outside* the min and max values"
|
|
167
|
+
# "'i'", "Callback is triggered when the temperature is *inside* the min and max values"
|
|
168
|
+
# "'<'", "Callback is triggered when the temperature is smaller than the min value (max is ignored)"
|
|
169
|
+
# "'>'", "Callback is triggered when the temperature is greater than the min value (max is ignored)"
|
|
170
|
+
#
|
|
171
|
+
# The default value is ('x', 0, 0, 0, 0, 0, 0, 0, 0).
|
|
172
|
+
def set_color_callback_threshold(option, min_r, max_r, min_g, max_g, min_b, max_b, min_c, max_c)
|
|
173
|
+
send_request(FUNCTION_SET_COLOR_CALLBACK_THRESHOLD, [option, min_r, max_r, min_g, max_g, min_b, max_b, min_c, max_c], 'k S S S S S S S S', 0, '')
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Returns the threshold as set by BrickletColor#set_color_callback_threshold.
|
|
177
|
+
def get_color_callback_threshold
|
|
178
|
+
send_request(FUNCTION_GET_COLOR_CALLBACK_THRESHOLD, [], '', 17, 'k S S S S S S S S')
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Sets the period in ms with which the threshold callback
|
|
182
|
+
#
|
|
183
|
+
# * CALLBACK_COLOR_REACHED
|
|
184
|
+
#
|
|
185
|
+
# is triggered, if the threshold
|
|
186
|
+
#
|
|
187
|
+
# * BrickletColor#set_color_callback_threshold
|
|
188
|
+
#
|
|
189
|
+
# keeps being reached.
|
|
190
|
+
#
|
|
191
|
+
# The default value is 100.
|
|
192
|
+
def set_debounce_period(debounce)
|
|
193
|
+
send_request(FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, '')
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Returns the debounce period as set by BrickletColor#set_debounce_period.
|
|
197
|
+
def get_debounce_period
|
|
198
|
+
send_request(FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L')
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Turns the LED on.
|
|
202
|
+
def light_on
|
|
203
|
+
send_request(FUNCTION_LIGHT_ON, [], '', 0, '')
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Turns the LED off.
|
|
207
|
+
def light_off
|
|
208
|
+
send_request(FUNCTION_LIGHT_OFF, [], '', 0, '')
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# Returns *true* if the backlight is on and *false* otherwise.
|
|
212
|
+
def is_light_on
|
|
213
|
+
send_request(FUNCTION_IS_LIGHT_ON, [], '', 1, 'C')
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# Sets the configuration of the sensor. Gain and integration time
|
|
217
|
+
# can be configured in this way.
|
|
218
|
+
#
|
|
219
|
+
# For configuring the gain:
|
|
220
|
+
#
|
|
221
|
+
# * 0: 1x Gain
|
|
222
|
+
# * 1: 4x Gain
|
|
223
|
+
# * 2: 16x Gain
|
|
224
|
+
# * 3: 60x Gain
|
|
225
|
+
#
|
|
226
|
+
# For configuring the integration time:
|
|
227
|
+
#
|
|
228
|
+
# * 0: 2.4ms
|
|
229
|
+
# * 1: 24ms
|
|
230
|
+
# * 2: 101ms
|
|
231
|
+
# * 3: 154ms
|
|
232
|
+
# * 4: 700ms
|
|
233
|
+
#
|
|
234
|
+
# Increasing the gain enables the sensor to detect a
|
|
235
|
+
# color from a higher distance.
|
|
236
|
+
#
|
|
237
|
+
# The integration time provides a trade-off between conversion time
|
|
238
|
+
# and accuracy. With a longer integration time the values read will
|
|
239
|
+
# be more accurate but it will take longer time to get the conversion
|
|
240
|
+
# results.
|
|
241
|
+
#
|
|
242
|
+
# The default values are 60x gain and 154ms integration time.
|
|
243
|
+
def set_config(gain, integration_time)
|
|
244
|
+
send_request(FUNCTION_SET_CONFIG, [gain, integration_time], 'C C', 0, '')
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
# Returns the configuration as set by BrickletColor#set_config.
|
|
248
|
+
def get_config
|
|
249
|
+
send_request(FUNCTION_GET_CONFIG, [], '', 2, 'C C')
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# Returns the illuminance affected by the gain and integration time as
|
|
253
|
+
# set by BrickletColor#set_config. To get the illuminance in Lux apply this formula::
|
|
254
|
+
#
|
|
255
|
+
# lux = illuminance * 700 / gain / integration_time
|
|
256
|
+
#
|
|
257
|
+
# To get a correct illuminance measurement make sure that the color
|
|
258
|
+
# values themself are not saturated. The color value (R, G or B)
|
|
259
|
+
# is saturated if it is equal to the maximum value of 65535.
|
|
260
|
+
# In that case you have to reduce the gain, see BrickletColor#set_config.
|
|
261
|
+
def get_illuminance
|
|
262
|
+
send_request(FUNCTION_GET_ILLUMINANCE, [], '', 4, 'L')
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
# Returns the color temperature in Kelvin.
|
|
266
|
+
#
|
|
267
|
+
# To get a correct color temperature measurement make sure that the color
|
|
268
|
+
# values themself are not saturated. The color value (R, G or B)
|
|
269
|
+
# is saturated if it is equal to the maximum value of 65535.
|
|
270
|
+
# In that case you have to reduce the gain, see BrickletColor#set_config.
|
|
271
|
+
def get_color_temperature
|
|
272
|
+
send_request(FUNCTION_GET_COLOR_TEMPERATURE, [], '', 2, 'S')
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
# Sets the period in ms with which the CALLBACK_ILLUMINANCE callback is triggered
|
|
276
|
+
# periodically. A value of 0 turns the callback off.
|
|
277
|
+
#
|
|
278
|
+
# CALLBACK_ILLUMINANCE is only triggered if the illuminance has changed since the
|
|
279
|
+
# last triggering.
|
|
280
|
+
#
|
|
281
|
+
# The default value is 0.
|
|
282
|
+
def set_illuminance_callback_period(period)
|
|
283
|
+
send_request(FUNCTION_SET_ILLUMINANCE_CALLBACK_PERIOD, [period], 'L', 0, '')
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
# Returns the period as set by BrickletColor#set_illuminance_callback_period.
|
|
287
|
+
def get_illuminance_callback_period
|
|
288
|
+
send_request(FUNCTION_GET_ILLUMINANCE_CALLBACK_PERIOD, [], '', 4, 'L')
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
# Sets the period in ms with which the CALLBACK_COLOR_TEMPERATURE callback is triggered
|
|
292
|
+
# periodically. A value of 0 turns the callback off.
|
|
293
|
+
#
|
|
294
|
+
# CALLBACK_COLOR_TEMPERATURE is only triggered if the color temperature has changed since the
|
|
295
|
+
# last triggering.
|
|
296
|
+
#
|
|
297
|
+
# The default value is 0.
|
|
298
|
+
def set_color_temperature_callback_period(period)
|
|
299
|
+
send_request(FUNCTION_SET_COLOR_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 0, '')
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
# Returns the period as set by BrickletColor#set_color_temperature_callback_period.
|
|
303
|
+
def get_color_temperature_callback_period
|
|
304
|
+
send_request(FUNCTION_GET_COLOR_TEMPERATURE_CALLBACK_PERIOD, [], '', 4, 'L')
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
|
308
|
+
# the position, the hardware and firmware version as well as the
|
|
309
|
+
# device identifier.
|
|
310
|
+
#
|
|
311
|
+
# The position can be 'a', 'b', 'c' or 'd'.
|
|
312
|
+
#
|
|
313
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
314
|
+
# |device_identifier_constant|
|
|
315
|
+
def get_identity
|
|
316
|
+
send_request(FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S')
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
|
320
|
+
def register_callback(id, &block)
|
|
321
|
+
callback = block
|
|
322
|
+
@registered_callbacks[id] = callback
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -120,6 +120,8 @@ module Tinkerforge
|
|
|
120
120
|
# * ('a', 128, 'i', false) or ('a', 0b10000000, 'i', false) will set pin 7 of port A as input default (floating if nothing is connected).
|
|
121
121
|
# * ('b', 3, 'o', false) or ('b', 0b00000011, 'o', false) will set pins 0 and 1 of port B as output low.
|
|
122
122
|
# * ('b', 4, 'o', true) or ('b', 0b00000100, 'o', true) will set pin 2 of port B as output high.
|
|
123
|
+
#
|
|
124
|
+
# The default configuration is input with pull-up.
|
|
123
125
|
def set_port_configuration(port, selection_mask, direction, value)
|
|
124
126
|
send_request(FUNCTION_SET_PORT_CONFIGURATION, [port, selection_mask, direction, value], 'k C k ?', 0, '')
|
|
125
127
|
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|
|
@@ -119,6 +119,8 @@ module Tinkerforge
|
|
|
119
119
|
# * (8, 'i', false) or (0b1000, 'i', false) will set pin 3 of as input default (floating if nothing is connected).
|
|
120
120
|
# * (3, 'o', false) or (0b0011, 'o', false) will set pins 0 and 1 as output low.
|
|
121
121
|
# * (4, 'o', true) or (0b0100, 'o', true) will set pin 2 of as output high.
|
|
122
|
+
#
|
|
123
|
+
# The default configuration is input with pull-up.
|
|
122
124
|
def set_configuration(selection_mask, direction, value)
|
|
123
125
|
send_request(FUNCTION_SET_CONFIGURATION, [selection_mask, direction, value], 'C k ?', 0, '')
|
|
124
126
|
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on 2014-
|
|
3
|
+
# This file was automatically generated on 2014-08-11. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Bindings Version 2.1.2 #
|
|
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 #
|