tinkerforge 2.1.6 → 2.1.7
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_imu_v2.rb +2 -2
- data/lib/tinkerforge/brick_master.rb +2 -2
- data/lib/tinkerforge/brick_red.rb +2 -2
- data/lib/tinkerforge/brick_servo.rb +2 -2
- data/lib/tinkerforge/brick_stepper.rb +2 -2
- data/lib/tinkerforge/bricklet_accelerometer.rb +2 -2
- data/lib/tinkerforge/bricklet_ambient_light.rb +2 -2
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_in.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +3 -3
- data/lib/tinkerforge/bricklet_analog_out.rb +2 -2
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +2 -2
- data/lib/tinkerforge/bricklet_barometer.rb +2 -2
- data/lib/tinkerforge/bricklet_co2.rb +158 -0
- data/lib/tinkerforge/bricklet_color.rb +2 -2
- 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_dust_detector.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_analog_out.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_dual_analog_in.rb +2 -2
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +2 -2
- data/lib/tinkerforge/bricklet_io16.rb +2 -2
- data/lib/tinkerforge/bricklet_io4.rb +2 -2
- data/lib/tinkerforge/bricklet_joystick.rb +2 -2
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +2 -2
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +5 -4
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +6 -5
- 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_load_cell.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 +2 -2
- data/lib/tinkerforge/bricklet_oled_128x64.rb +124 -0
- data/lib/tinkerforge/bricklet_oled_64x48.rb +123 -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_rs232.rb +2 -2
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +2 -2
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +2 -2
- 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_thermocouple.rb +235 -0
- data/lib/tinkerforge/bricklet_tilt.rb +2 -2
- data/lib/tinkerforge/bricklet_uv_light.rb +160 -0
- 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 +7 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on
|
|
3
|
+
# This file was automatically generated on 2016-01-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.7 #
|
|
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
|
|
3
|
+
# This file was automatically generated on 2016-01-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.7 #
|
|
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
|
|
3
|
+
# This file was automatically generated on 2016-01-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.7 #
|
|
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
|
|
3
|
+
# This file was automatically generated on 2016-01-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.7 #
|
|
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
|
|
3
|
+
# This file was automatically generated on 2016-01-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.7 #
|
|
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
|
|
3
|
+
# This file was automatically generated on 2016-01-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.7 #
|
|
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
|
|
3
|
+
# This file was automatically generated on 2016-01-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.7 #
|
|
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
|
|
3
|
+
# This file was automatically generated on 2016-01-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.7 #
|
|
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
|
|
3
|
+
# This file was automatically generated on 2016-01-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.7 #
|
|
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
|
|
3
|
+
# This file was automatically generated on 2016-01-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.7 #
|
|
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
|
|
3
|
+
# This file was automatically generated on 2016-01-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.7 #
|
|
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
|
|
3
|
+
# This file was automatically generated on 2016-01-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.7 #
|
|
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,235 @@
|
|
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
|
2
|
+
#############################################################
|
|
3
|
+
# This file was automatically generated on 2016-01-06. #
|
|
4
|
+
# #
|
|
5
|
+
# Ruby Bindings Version 2.1.7 #
|
|
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 generators git repository on tinkerforge.com #
|
|
10
|
+
#############################################################
|
|
11
|
+
|
|
12
|
+
module Tinkerforge
|
|
13
|
+
# Measures temperature with thermocouples
|
|
14
|
+
class BrickletThermocouple < Device
|
|
15
|
+
DEVICE_IDENTIFIER = 266 # :nodoc:
|
|
16
|
+
DEVICE_DISPLAY_NAME = 'Thermocouple Bricklet' # :nodoc:
|
|
17
|
+
|
|
18
|
+
# This callback is triggered periodically with the period that is set by
|
|
19
|
+
# :func:`SetThermocoupleCallbackPeriod`. The parameter is the temperature
|
|
20
|
+
# of the thermocouple.
|
|
21
|
+
#
|
|
22
|
+
# CALLBACK_TEMPERATURE is only triggered if the temperature has changed since the
|
|
23
|
+
# last triggering.
|
|
24
|
+
CALLBACK_TEMPERATURE = 8
|
|
25
|
+
|
|
26
|
+
# This callback is triggered when the threshold as set by
|
|
27
|
+
# BrickletThermocouple#set_temperature_callback_threshold is reached.
|
|
28
|
+
# The parameter is the temperature of the thermocouple.
|
|
29
|
+
#
|
|
30
|
+
# If the threshold keeps being reached, the callback is triggered periodically
|
|
31
|
+
# with the period as set by BrickletThermocouple#set_debounce_period.
|
|
32
|
+
CALLBACK_TEMPERATURE_REACHED = 9
|
|
33
|
+
|
|
34
|
+
# This Callback is triggered every time the error state changes
|
|
35
|
+
# (see func:`GetErrorStatus`).
|
|
36
|
+
CALLBACK_ERROR_STATE = 13
|
|
37
|
+
|
|
38
|
+
FUNCTION_GET_TEMPERATURE = 1 # :nodoc:
|
|
39
|
+
FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD = 2 # :nodoc:
|
|
40
|
+
FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD = 3 # :nodoc:
|
|
41
|
+
FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD = 4 # :nodoc:
|
|
42
|
+
FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD = 5 # :nodoc:
|
|
43
|
+
FUNCTION_SET_DEBOUNCE_PERIOD = 6 # :nodoc:
|
|
44
|
+
FUNCTION_GET_DEBOUNCE_PERIOD = 7 # :nodoc:
|
|
45
|
+
FUNCTION_SET_CONFIGURATION = 10 # :nodoc:
|
|
46
|
+
FUNCTION_GET_CONFIGURATION = 11 # :nodoc:
|
|
47
|
+
FUNCTION_GET_ERROR_STATE = 12 # :nodoc:
|
|
48
|
+
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
|
49
|
+
|
|
50
|
+
THRESHOLD_OPTION_OFF = 'x' # :nodoc:
|
|
51
|
+
THRESHOLD_OPTION_OUTSIDE = 'o' # :nodoc:
|
|
52
|
+
THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
|
|
53
|
+
THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
|
|
54
|
+
THRESHOLD_OPTION_GREATER = '>' # :nodoc:
|
|
55
|
+
AVERAGING_1 = 1 # :nodoc:
|
|
56
|
+
AVERAGING_2 = 2 # :nodoc:
|
|
57
|
+
AVERAGING_4 = 4 # :nodoc:
|
|
58
|
+
AVERAGING_8 = 8 # :nodoc:
|
|
59
|
+
AVERAGING_16 = 16 # :nodoc:
|
|
60
|
+
TYPE_B = 0 # :nodoc:
|
|
61
|
+
TYPE_E = 1 # :nodoc:
|
|
62
|
+
TYPE_J = 2 # :nodoc:
|
|
63
|
+
TYPE_K = 3 # :nodoc:
|
|
64
|
+
TYPE_N = 4 # :nodoc:
|
|
65
|
+
TYPE_R = 5 # :nodoc:
|
|
66
|
+
TYPE_S = 6 # :nodoc:
|
|
67
|
+
TYPE_T = 7 # :nodoc:
|
|
68
|
+
TYPE_G8 = 8 # :nodoc:
|
|
69
|
+
TYPE_G32 = 9 # :nodoc:
|
|
70
|
+
FILTER_OPTION_50HZ = 0 # :nodoc:
|
|
71
|
+
FILTER_OPTION_60HZ = 1 # :nodoc:
|
|
72
|
+
|
|
73
|
+
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
74
|
+
# the IP Connection <tt>ipcon</tt>.
|
|
75
|
+
def initialize(uid, ipcon)
|
|
76
|
+
super uid, ipcon
|
|
77
|
+
|
|
78
|
+
@api_version = [2, 0, 0]
|
|
79
|
+
|
|
80
|
+
@response_expected[FUNCTION_GET_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
81
|
+
@response_expected[FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
|
|
82
|
+
@response_expected[FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
83
|
+
@response_expected[FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_TRUE
|
|
84
|
+
@response_expected[FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
85
|
+
@response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
|
|
86
|
+
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
87
|
+
@response_expected[CALLBACK_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
88
|
+
@response_expected[CALLBACK_TEMPERATURE_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
89
|
+
@response_expected[FUNCTION_SET_CONFIGURATION] = RESPONSE_EXPECTED_FALSE
|
|
90
|
+
@response_expected[FUNCTION_GET_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
91
|
+
@response_expected[FUNCTION_GET_ERROR_STATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
92
|
+
@response_expected[CALLBACK_ERROR_STATE] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
93
|
+
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
94
|
+
|
|
95
|
+
@callback_formats[CALLBACK_TEMPERATURE] = 'l'
|
|
96
|
+
@callback_formats[CALLBACK_TEMPERATURE_REACHED] = 'l'
|
|
97
|
+
@callback_formats[CALLBACK_ERROR_STATE] = '? ?'
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Returns the temperature of the thermocouple. The value is given in °C/100,
|
|
101
|
+
# e.g. a value of 4223 means that a temperature of 42.23 °C is measured.
|
|
102
|
+
#
|
|
103
|
+
# If you want to get the temperature periodically, it is recommended
|
|
104
|
+
# to use the callback CALLBACK_TEMPERATURE and set the period with
|
|
105
|
+
# BrickletThermocouple#set_temperature_callback_period.
|
|
106
|
+
def get_temperature
|
|
107
|
+
send_request(FUNCTION_GET_TEMPERATURE, [], '', 4, 'l')
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Sets the period in ms with which the CALLBACK_TEMPERATURE callback is triggered
|
|
111
|
+
# periodically. A value of 0 turns the callback off.
|
|
112
|
+
#
|
|
113
|
+
# CALLBACK_TEMPERATURE is only triggered if the temperature has changed since the
|
|
114
|
+
# last triggering.
|
|
115
|
+
#
|
|
116
|
+
# The default value is 0.
|
|
117
|
+
def set_temperature_callback_period(period)
|
|
118
|
+
send_request(FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 0, '')
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Returns the period as set by BrickletThermocouple#set_temperature_callback_period.
|
|
122
|
+
def get_temperature_callback_period
|
|
123
|
+
send_request(FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD, [], '', 4, 'L')
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Sets the thresholds for the CALLBACK_TEMPERATURE_REACHED callback.
|
|
127
|
+
#
|
|
128
|
+
# The following options are possible:
|
|
129
|
+
#
|
|
130
|
+
# "Option", "Description"
|
|
131
|
+
#
|
|
132
|
+
# "'x'", "Callback is turned off"
|
|
133
|
+
# "'o'", "Callback is triggered when the temperature is *outside* the min and max values"
|
|
134
|
+
# "'i'", "Callback is triggered when the temperature is *inside* the min and max values"
|
|
135
|
+
# "'<'", "Callback is triggered when the temperature is smaller than the min value (max is ignored)"
|
|
136
|
+
# "'>'", "Callback is triggered when the temperature is greater than the min value (max is ignored)"
|
|
137
|
+
#
|
|
138
|
+
# The default value is ('x', 0, 0).
|
|
139
|
+
def set_temperature_callback_threshold(option, min, max)
|
|
140
|
+
send_request(FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 0, '')
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Returns the threshold as set by BrickletThermocouple#set_temperature_callback_threshold.
|
|
144
|
+
def get_temperature_callback_threshold
|
|
145
|
+
send_request(FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 9, 'k l l')
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Sets the period in ms with which the threshold callback
|
|
149
|
+
#
|
|
150
|
+
# * CALLBACK_TEMPERATURE_REACHED
|
|
151
|
+
#
|
|
152
|
+
# is triggered, if the threshold
|
|
153
|
+
#
|
|
154
|
+
# * BrickletThermocouple#set_temperature_callback_threshold
|
|
155
|
+
#
|
|
156
|
+
# keeps being reached.
|
|
157
|
+
#
|
|
158
|
+
# The default value is 100.
|
|
159
|
+
def set_debounce_period(debounce)
|
|
160
|
+
send_request(FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, '')
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Returns the debounce period as set by BrickletThermocouple#set_debounce_period.
|
|
164
|
+
def get_debounce_period
|
|
165
|
+
send_request(FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L')
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# You can configure averaging size, thermocouple type and frequency
|
|
169
|
+
# filtering.
|
|
170
|
+
#
|
|
171
|
+
# Available averaging sizes are 1, 2, 4, 8 and 16 samples.
|
|
172
|
+
#
|
|
173
|
+
# As thermocouple type you can use B, E, J, K, N, R, S and T. If you have a
|
|
174
|
+
# different thermocouple or a custom thermocouple you can also use
|
|
175
|
+
# G8 and G32. With these types the returned value will not be in °C/100,
|
|
176
|
+
# it will be calculated by the following formulas:
|
|
177
|
+
#
|
|
178
|
+
# * G8: ``value = 8 * 1.6 * 2^17 * Vin``
|
|
179
|
+
# * G32: ``value = 32 * 1.6 * 2^17 * Vin``
|
|
180
|
+
#
|
|
181
|
+
# where Vin is the thermocouple input voltage.
|
|
182
|
+
#
|
|
183
|
+
# The frequency filter can be either configured to 50Hz or to 60Hz. You should
|
|
184
|
+
# configure it according to your utility frequency.
|
|
185
|
+
#
|
|
186
|
+
# The conversion time depends on the averaging and filter configuration, it can
|
|
187
|
+
# be calculated as follows:
|
|
188
|
+
#
|
|
189
|
+
# * 60Hz: ``time = 82 + (samples - 1) * 16.67``
|
|
190
|
+
# * 50Hz: ``time = 98 + (samples - 1) * 20``
|
|
191
|
+
#
|
|
192
|
+
# The default configuration is 16 samples, K type and 50Hz.
|
|
193
|
+
def set_configuration(averaging, thermocouple_type, filter)
|
|
194
|
+
send_request(FUNCTION_SET_CONFIGURATION, [averaging, thermocouple_type, filter], 'C C C', 0, '')
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Returns the configuration as set by BrickletThermocouple#set_configuration.
|
|
198
|
+
def get_configuration
|
|
199
|
+
send_request(FUNCTION_GET_CONFIGURATION, [], '', 3, 'C C C')
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# Returns the current error state. There are two possible errors:
|
|
203
|
+
#
|
|
204
|
+
# * Over/Under Voltage and
|
|
205
|
+
# * Open Circuit.
|
|
206
|
+
#
|
|
207
|
+
# Over/Under Voltage happens for voltages below 0V or above 3.3V. In this case
|
|
208
|
+
# it is very likely that your thermocouple is defective. An Open Circuit error
|
|
209
|
+
# indicates that there is no thermocouple connected.
|
|
210
|
+
#
|
|
211
|
+
# You can use the func:`ErrorState` callback to automatically get triggered
|
|
212
|
+
# when the error state changes.
|
|
213
|
+
def get_error_state
|
|
214
|
+
send_request(FUNCTION_GET_ERROR_STATE, [], '', 2, '? ?')
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
|
218
|
+
# the position, the hardware and firmware version as well as the
|
|
219
|
+
# device identifier.
|
|
220
|
+
#
|
|
221
|
+
# The position can be 'a', 'b', 'c' or 'd'.
|
|
222
|
+
#
|
|
223
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
224
|
+
# |device_identifier_constant|
|
|
225
|
+
def get_identity
|
|
226
|
+
send_request(FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S')
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
|
230
|
+
def register_callback(id, &block)
|
|
231
|
+
callback = block
|
|
232
|
+
@registered_callbacks[id] = callback
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
|
2
2
|
#############################################################
|
|
3
|
-
# This file was automatically generated on
|
|
3
|
+
# This file was automatically generated on 2016-01-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.7 #
|
|
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,160 @@
|
|
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
|
2
|
+
#############################################################
|
|
3
|
+
# This file was automatically generated on 2016-01-06. #
|
|
4
|
+
# #
|
|
5
|
+
# Ruby Bindings Version 2.1.7 #
|
|
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 generators git repository on tinkerforge.com #
|
|
10
|
+
#############################################################
|
|
11
|
+
|
|
12
|
+
module Tinkerforge
|
|
13
|
+
# Measures UV Light
|
|
14
|
+
class BrickletUVLight < Device
|
|
15
|
+
DEVICE_IDENTIFIER = 265 # :nodoc:
|
|
16
|
+
DEVICE_DISPLAY_NAME = 'UV Light Bricklet' # :nodoc:
|
|
17
|
+
|
|
18
|
+
# This callback is triggered periodically with the period that is set by
|
|
19
|
+
# BrickletUVLight#set_uv_light_callback_period. The parameter is the UV Light
|
|
20
|
+
# intensity of the sensor.
|
|
21
|
+
#
|
|
22
|
+
# CALLBACK_UV_LIGHT is only triggered if the intensity has changed since the
|
|
23
|
+
# last triggering.
|
|
24
|
+
CALLBACK_UV_LIGHT = 8
|
|
25
|
+
|
|
26
|
+
# This callback is triggered when the threshold as set by
|
|
27
|
+
# BrickletUVLight#set_uv_light_callback_threshold is reached.
|
|
28
|
+
# The parameter is the UV Light intensity of the sensor.
|
|
29
|
+
#
|
|
30
|
+
# If the threshold keeps being reached, the callback is triggered periodically
|
|
31
|
+
# with the period as set by BrickletUVLight#set_debounce_period.
|
|
32
|
+
CALLBACK_UV_LIGHT_REACHED = 9
|
|
33
|
+
|
|
34
|
+
FUNCTION_GET_UV_LIGHT = 1 # :nodoc:
|
|
35
|
+
FUNCTION_SET_UV_LIGHT_CALLBACK_PERIOD = 2 # :nodoc:
|
|
36
|
+
FUNCTION_GET_UV_LIGHT_CALLBACK_PERIOD = 3 # :nodoc:
|
|
37
|
+
FUNCTION_SET_UV_LIGHT_CALLBACK_THRESHOLD = 4 # :nodoc:
|
|
38
|
+
FUNCTION_GET_UV_LIGHT_CALLBACK_THRESHOLD = 5 # :nodoc:
|
|
39
|
+
FUNCTION_SET_DEBOUNCE_PERIOD = 6 # :nodoc:
|
|
40
|
+
FUNCTION_GET_DEBOUNCE_PERIOD = 7 # :nodoc:
|
|
41
|
+
FUNCTION_GET_IDENTITY = 255 # :nodoc:
|
|
42
|
+
|
|
43
|
+
THRESHOLD_OPTION_OFF = 'x' # :nodoc:
|
|
44
|
+
THRESHOLD_OPTION_OUTSIDE = 'o' # :nodoc:
|
|
45
|
+
THRESHOLD_OPTION_INSIDE = 'i' # :nodoc:
|
|
46
|
+
THRESHOLD_OPTION_SMALLER = '<' # :nodoc:
|
|
47
|
+
THRESHOLD_OPTION_GREATER = '>' # :nodoc:
|
|
48
|
+
|
|
49
|
+
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
50
|
+
# the IP Connection <tt>ipcon</tt>.
|
|
51
|
+
def initialize(uid, ipcon)
|
|
52
|
+
super uid, ipcon
|
|
53
|
+
|
|
54
|
+
@api_version = [2, 0, 0]
|
|
55
|
+
|
|
56
|
+
@response_expected[FUNCTION_GET_UV_LIGHT] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
57
|
+
@response_expected[FUNCTION_SET_UV_LIGHT_CALLBACK_PERIOD] = RESPONSE_EXPECTED_TRUE
|
|
58
|
+
@response_expected[FUNCTION_GET_UV_LIGHT_CALLBACK_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
59
|
+
@response_expected[FUNCTION_SET_UV_LIGHT_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_TRUE
|
|
60
|
+
@response_expected[FUNCTION_GET_UV_LIGHT_CALLBACK_THRESHOLD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
61
|
+
@response_expected[FUNCTION_SET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_TRUE
|
|
62
|
+
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
63
|
+
@response_expected[CALLBACK_UV_LIGHT] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
64
|
+
@response_expected[CALLBACK_UV_LIGHT_REACHED] = RESPONSE_EXPECTED_ALWAYS_FALSE
|
|
65
|
+
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
66
|
+
|
|
67
|
+
@callback_formats[CALLBACK_UV_LIGHT] = 'L'
|
|
68
|
+
@callback_formats[CALLBACK_UV_LIGHT_REACHED] = 'L'
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Returns the UV Light intensity of the sensor, the intensity is given
|
|
72
|
+
# in µW/cm².
|
|
73
|
+
#
|
|
74
|
+
# To get UV Index you have to divide the value by 250. For example, a UV Light
|
|
75
|
+
# intensity of 500µW/cm² is equivalent to an UV Index of 2.
|
|
76
|
+
#
|
|
77
|
+
# If you want to get the intensity periodically, it is recommended to use the
|
|
78
|
+
# callback CALLBACK_UV_LIGHT and set the period with
|
|
79
|
+
# BrickletUVLight#set_uv_light_callback_period.
|
|
80
|
+
def get_uv_light
|
|
81
|
+
send_request(FUNCTION_GET_UV_LIGHT, [], '', 4, 'L')
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Sets the period in ms with which the CALLBACK_UV_LIGHT callback is triggered
|
|
85
|
+
# periodically. A value of 0 turns the callback off.
|
|
86
|
+
#
|
|
87
|
+
# CALLBACK_UV_LIGHT is only triggered if the intensity has changed since the
|
|
88
|
+
# last triggering.
|
|
89
|
+
#
|
|
90
|
+
# The default value is 0.
|
|
91
|
+
def set_uv_light_callback_period(period)
|
|
92
|
+
send_request(FUNCTION_SET_UV_LIGHT_CALLBACK_PERIOD, [period], 'L', 0, '')
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Returns the period as set by BrickletUVLight#set_uv_light_callback_period.
|
|
96
|
+
def get_uv_light_callback_period
|
|
97
|
+
send_request(FUNCTION_GET_UV_LIGHT_CALLBACK_PERIOD, [], '', 4, 'L')
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Sets the thresholds for the CALLBACK_UV_LIGHT_REACHED callback.
|
|
101
|
+
#
|
|
102
|
+
# The following options are possible:
|
|
103
|
+
#
|
|
104
|
+
# "Option", "Description"
|
|
105
|
+
#
|
|
106
|
+
# "'x'", "Callback is turned off"
|
|
107
|
+
# "'o'", "Callback is triggered when the intensity is *outside* the min and max values"
|
|
108
|
+
# "'i'", "Callback is triggered when the intensity is *inside* the min and max values"
|
|
109
|
+
# "'<'", "Callback is triggered when the intensity is smaller than the min value (max is ignored)"
|
|
110
|
+
# "'>'", "Callback is triggered when the intensity is greater than the min value (max is ignored)"
|
|
111
|
+
#
|
|
112
|
+
# The default value is ('x', 0, 0).
|
|
113
|
+
def set_uv_light_callback_threshold(option, min, max)
|
|
114
|
+
send_request(FUNCTION_SET_UV_LIGHT_CALLBACK_THRESHOLD, [option, min, max], 'k L L', 0, '')
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Returns the threshold as set by BrickletUVLight#set_uv_light_callback_threshold.
|
|
118
|
+
def get_uv_light_callback_threshold
|
|
119
|
+
send_request(FUNCTION_GET_UV_LIGHT_CALLBACK_THRESHOLD, [], '', 9, 'k L L')
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Sets the period in ms with which the threshold callbacks
|
|
123
|
+
#
|
|
124
|
+
# * CALLBACK_UV_LIGHT_REACHED,
|
|
125
|
+
#
|
|
126
|
+
# are triggered, if the thresholds
|
|
127
|
+
#
|
|
128
|
+
# * BrickletUVLight#set_uv_light_callback_threshold,
|
|
129
|
+
#
|
|
130
|
+
# keep being reached.
|
|
131
|
+
#
|
|
132
|
+
# The default value is 100.
|
|
133
|
+
def set_debounce_period(debounce)
|
|
134
|
+
send_request(FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 0, '')
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Returns the debounce period as set by BrickletUVLight#set_debounce_period.
|
|
138
|
+
def get_debounce_period
|
|
139
|
+
send_request(FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 4, 'L')
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# Returns the UID, the UID where the Bricklet is connected to,
|
|
143
|
+
# the position, the hardware and firmware version as well as the
|
|
144
|
+
# device identifier.
|
|
145
|
+
#
|
|
146
|
+
# The position can be 'a', 'b', 'c' or 'd'.
|
|
147
|
+
#
|
|
148
|
+
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
149
|
+
# |device_identifier_constant|
|
|
150
|
+
def get_identity
|
|
151
|
+
send_request(FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S')
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
|
155
|
+
def register_callback(id, &block)
|
|
156
|
+
callback = block
|
|
157
|
+
@registered_callbacks[id] = callback
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|