tinkerforge 2.1.22 → 2.1.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/tinkerforge/brick_dc.rb +157 -76
- data/lib/tinkerforge/brick_hat.rb +115 -32
- data/lib/tinkerforge/brick_hat_zero.rb +119 -21
- data/lib/tinkerforge/brick_imu.rb +192 -87
- data/lib/tinkerforge/brick_imu_v2.rb +220 -119
- data/lib/tinkerforge/brick_master.rb +498 -198
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +187 -103
- data/lib/tinkerforge/brick_silent_stepper.rb +249 -169
- data/lib/tinkerforge/brick_stepper.rb +214 -102
- data/lib/tinkerforge/bricklet_accelerometer.rb +61 -36
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +167 -48
- data/lib/tinkerforge/bricklet_air_quality.rb +123 -76
- data/lib/tinkerforge/bricklet_ambient_light.rb +62 -46
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +41 -28
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +61 -28
- data/lib/tinkerforge/bricklet_analog_in.rb +66 -45
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +60 -43
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +68 -32
- data/lib/tinkerforge/bricklet_analog_out.rb +25 -16
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +21 -10
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +55 -22
- data/lib/tinkerforge/bricklet_barometer.rb +108 -58
- data/lib/tinkerforge/bricklet_barometer_v2.rb +109 -67
- data/lib/tinkerforge/bricklet_can.rb +84 -24
- data/lib/tinkerforge/bricklet_can_v2.rb +173 -72
- data/lib/tinkerforge/bricklet_co2.rb +36 -25
- data/lib/tinkerforge/bricklet_co2_v2.rb +119 -60
- data/lib/tinkerforge/bricklet_color.rb +77 -49
- data/lib/tinkerforge/bricklet_color_v2.rb +493 -0
- data/lib/tinkerforge/bricklet_compass.rb +397 -0
- data/lib/tinkerforge/bricklet_current12.rb +61 -40
- data/lib/tinkerforge/bricklet_current25.rb +61 -40
- data/lib/tinkerforge/bricklet_distance_ir.rb +60 -38
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +85 -45
- data/lib/tinkerforge/bricklet_distance_us.rb +43 -30
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +335 -0
- data/lib/tinkerforge/bricklet_dmx.rb +92 -48
- data/lib/tinkerforge/bricklet_dual_button.rb +23 -12
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +64 -29
- data/lib/tinkerforge/bricklet_dual_relay.rb +27 -14
- data/lib/tinkerforge/bricklet_dust_detector.rb +43 -30
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +115 -63
- data/lib/tinkerforge/bricklet_energy_monitor.rb +416 -0
- data/lib/tinkerforge/bricklet_gps.rb +72 -48
- data/lib/tinkerforge/bricklet_gps_v2.rb +124 -73
- data/lib/tinkerforge/bricklet_hall_effect.rb +43 -28
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +76 -44
- data/lib/tinkerforge/bricklet_humidity.rb +54 -38
- data/lib/tinkerforge/bricklet_humidity_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +41 -18
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +84 -40
- data/lib/tinkerforge/bricklet_industrial_counter.rb +102 -59
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +51 -24
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +79 -40
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +75 -33
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +43 -29
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +81 -44
- data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +51 -30
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +139 -40
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +63 -28
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +36 -15
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +67 -28
- data/lib/tinkerforge/bricklet_io16.rb +57 -32
- data/lib/tinkerforge/bricklet_io16_v2.rb +93 -48
- data/lib/tinkerforge/bricklet_io4.rb +56 -31
- data/lib/tinkerforge/bricklet_io4_v2.rb +109 -57
- data/lib/tinkerforge/bricklet_isolator.rb +111 -35
- data/lib/tinkerforge/bricklet_joystick.rb +63 -42
- data/lib/tinkerforge/bricklet_joystick_v2.rb +71 -35
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +87 -59
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +101 -53
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +241 -131
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +49 -25
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +59 -29
- data/lib/tinkerforge/bricklet_led_strip.rb +69 -47
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +105 -48
- data/lib/tinkerforge/bricklet_line.rb +35 -22
- data/lib/tinkerforge/bricklet_linear_poti.rb +53 -35
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +55 -24
- data/lib/tinkerforge/bricklet_load_cell.rb +64 -40
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +81 -41
- data/lib/tinkerforge/bricklet_moisture.rb +43 -30
- data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +62 -29
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +71 -32
- data/lib/tinkerforge/bricklet_multi_touch.rb +30 -17
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +371 -0
- data/lib/tinkerforge/bricklet_nfc.rb +130 -80
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +30 -17
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +97 -40
- data/lib/tinkerforge/bricklet_oled_64x48.rb +30 -17
- data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +84 -41
- data/lib/tinkerforge/bricklet_particulate_matter.rb +85 -37
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +19 -13
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +22 -19
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +84 -57
- data/lib/tinkerforge/bricklet_ptc.rb +76 -51
- data/lib/tinkerforge/bricklet_ptc_v2.rb +96 -54
- data/lib/tinkerforge/bricklet_real_time_clock.rb +45 -36
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +78 -47
- data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
- data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
- data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
- data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
- data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
- data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
- data/lib/tinkerforge/bricklet_rotary_encoder.rb +40 -25
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +60 -27
- data/lib/tinkerforge/bricklet_rotary_poti.rb +55 -37
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +290 -0
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +121 -47
- data/lib/tinkerforge/bricklet_rs485.rb +303 -207
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +75 -36
- data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
- data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
- data/lib/tinkerforge/bricklet_sound_intensity.rb +36 -24
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +77 -41
- data/lib/tinkerforge/bricklet_temperature.rb +43 -28
- data/lib/tinkerforge/bricklet_temperature_ir.rb +63 -47
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +75 -53
- data/lib/tinkerforge/bricklet_temperature_v2.rb +62 -31
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +118 -68
- data/lib/tinkerforge/bricklet_thermocouple.rb +46 -30
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +65 -30
- data/lib/tinkerforge/bricklet_tilt.rb +23 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +37 -24
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +87 -46
- data/lib/tinkerforge/bricklet_voltage.rb +54 -37
- data/lib/tinkerforge/bricklet_voltage_current.rb +94 -85
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +103 -77
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +410 -0
- data/lib/tinkerforge/device_display_names.rb +165 -0
- data/lib/tinkerforge/ip_connection.rb +155 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +14 -4
@@ -1,14 +1,16 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2020-11-02. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.27 #
|
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 #
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
|
+
require_relative './ip_connection'
|
13
|
+
|
12
14
|
module Tinkerforge
|
13
15
|
# Measures CO2 concentration in ppm
|
14
16
|
class BrickletCO2 < Device
|
@@ -49,7 +51,7 @@ module Tinkerforge
|
|
49
51
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
50
52
|
# the IP Connection <tt>ipcon</tt>.
|
51
53
|
def initialize(uid, ipcon)
|
52
|
-
super uid, ipcon
|
54
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
53
55
|
|
54
56
|
@api_version = [2, 0, 0]
|
55
57
|
|
@@ -62,36 +64,39 @@ module Tinkerforge
|
|
62
64
|
@response_expected[FUNCTION_GET_DEBOUNCE_PERIOD] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
63
65
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
64
66
|
|
65
|
-
@callback_formats[CALLBACK_CO2_CONCENTRATION] = 'S'
|
66
|
-
@callback_formats[CALLBACK_CO2_CONCENTRATION_REACHED] = 'S'
|
67
|
+
@callback_formats[CALLBACK_CO2_CONCENTRATION] = [10, 'S']
|
68
|
+
@callback_formats[CALLBACK_CO2_CONCENTRATION_REACHED] = [10, 'S']
|
67
69
|
|
70
|
+
@ipcon.add_device self
|
68
71
|
end
|
69
72
|
|
70
|
-
# Returns the measured CO2 concentration.
|
71
|
-
# `ppm (parts per million) <https://en.wikipedia.org/wiki/Parts-per_notation>`__
|
72
|
-
# and between 0 to 10000.
|
73
|
+
# Returns the measured CO2 concentration.
|
73
74
|
#
|
74
75
|
# If you want to get the CO2 concentration periodically, it is recommended to use
|
75
76
|
# the CALLBACK_CO2_CONCENTRATION callback and set the period with
|
76
77
|
# BrickletCO2#set_co2_concentration_callback_period.
|
77
78
|
def get_co2_concentration
|
78
|
-
|
79
|
+
check_validity
|
80
|
+
|
81
|
+
send_request FUNCTION_GET_CO2_CONCENTRATION, [], '', 10, 'S'
|
79
82
|
end
|
80
83
|
|
81
|
-
# Sets the period
|
84
|
+
# Sets the period with which the CALLBACK_CO2_CONCENTRATION callback is
|
82
85
|
# triggered periodically. A value of 0 turns the callback off.
|
83
86
|
#
|
84
87
|
# The CALLBACK_CO2_CONCENTRATION callback is only triggered if the CO2 concentration
|
85
88
|
# has changed since the last triggering.
|
86
|
-
#
|
87
|
-
# The default value is 0.
|
88
89
|
def set_co2_concentration_callback_period(period)
|
89
|
-
|
90
|
+
check_validity
|
91
|
+
|
92
|
+
send_request FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_PERIOD, [period], 'L', 8, ''
|
90
93
|
end
|
91
94
|
|
92
95
|
# Returns the period as set by BrickletCO2#set_co2_concentration_callback_period.
|
93
96
|
def get_co2_concentration_callback_period
|
94
|
-
|
97
|
+
check_validity
|
98
|
+
|
99
|
+
send_request FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_PERIOD, [], '', 12, 'L'
|
95
100
|
end
|
96
101
|
|
97
102
|
# Sets the thresholds for the CALLBACK_CO2_CONCENTRATION_REACHED callback.
|
@@ -105,18 +110,20 @@ module Tinkerforge
|
|
105
110
|
# "'i'", "Callback is triggered when the CO2 concentration is *inside* the min and max values"
|
106
111
|
# "'<'", "Callback is triggered when the CO2 concentration is smaller than the min value (max is ignored)"
|
107
112
|
# "'>'", "Callback is triggered when the CO2 concentration is greater than the min value (max is ignored)"
|
108
|
-
#
|
109
|
-
# The default value is ('x', 0, 0).
|
110
113
|
def set_co2_concentration_callback_threshold(option, min, max)
|
111
|
-
|
114
|
+
check_validity
|
115
|
+
|
116
|
+
send_request FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_THRESHOLD, [option, min, max], 'k S S', 8, ''
|
112
117
|
end
|
113
118
|
|
114
119
|
# Returns the threshold as set by BrickletCO2#set_co2_concentration_callback_threshold.
|
115
120
|
def get_co2_concentration_callback_threshold
|
116
|
-
|
121
|
+
check_validity
|
122
|
+
|
123
|
+
send_request FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_THRESHOLD, [], '', 13, 'k S S'
|
117
124
|
end
|
118
125
|
|
119
|
-
# Sets the period
|
126
|
+
# Sets the period with which the threshold callbacks
|
120
127
|
#
|
121
128
|
# * CALLBACK_CO2_CONCENTRATION_REACHED,
|
122
129
|
#
|
@@ -125,27 +132,31 @@ module Tinkerforge
|
|
125
132
|
# * BrickletCO2#set_co2_concentration_callback_threshold,
|
126
133
|
#
|
127
134
|
# keep being reached.
|
128
|
-
#
|
129
|
-
# The default value is 100.
|
130
135
|
def set_debounce_period(debounce)
|
131
|
-
|
136
|
+
check_validity
|
137
|
+
|
138
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
|
132
139
|
end
|
133
140
|
|
134
141
|
# Returns the debounce period as set by BrickletCO2#set_debounce_period.
|
135
142
|
def get_debounce_period
|
136
|
-
|
143
|
+
check_validity
|
144
|
+
|
145
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
|
137
146
|
end
|
138
147
|
|
139
148
|
# Returns the UID, the UID where the Bricklet is connected to,
|
140
149
|
# the position, the hardware and firmware version as well as the
|
141
150
|
# device identifier.
|
142
151
|
#
|
143
|
-
# The position can be 'a', 'b', 'c' or '
|
152
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
153
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
154
|
+
# position 'z'.
|
144
155
|
#
|
145
156
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
146
157
|
# |device_identifier_constant|
|
147
158
|
def get_identity
|
148
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
159
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
149
160
|
end
|
150
161
|
|
151
162
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|
@@ -1,14 +1,16 @@
|
|
1
1
|
# -*- ruby encoding: utf-8 -*-
|
2
2
|
#############################################################
|
3
|
-
# This file was automatically generated on
|
3
|
+
# This file was automatically generated on 2020-11-02. #
|
4
4
|
# #
|
5
|
-
# Ruby Bindings Version 2.1.
|
5
|
+
# Ruby Bindings Version 2.1.27 #
|
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 #
|
9
9
|
# to the generators git repository on tinkerforge.com #
|
10
10
|
#############################################################
|
11
11
|
|
12
|
+
require_relative './ip_connection'
|
13
|
+
|
12
14
|
module Tinkerforge
|
13
15
|
# Measures CO2 concentration, temperature and humidity
|
14
16
|
class BrickletCO2V2 < Device
|
@@ -19,6 +21,10 @@ module Tinkerforge
|
|
19
21
|
# BrickletCO2V2#set_all_values_callback_configuration.
|
20
22
|
#
|
21
23
|
# The parameters are the same as BrickletCO2V2#get_all_values.
|
24
|
+
#
|
25
|
+
# .. note::
|
26
|
+
# The sensor is able to messure up to 120 °C. However it is only specified up to 70 °C.
|
27
|
+
# Exposing the Bricklet to higher temperatures might result in permanent damage.
|
22
28
|
CALLBACK_ALL_VALUES = 8
|
23
29
|
|
24
30
|
# This callback is triggered periodically according to the configuration set by
|
@@ -92,7 +98,7 @@ module Tinkerforge
|
|
92
98
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
93
99
|
# the IP Connection <tt>ipcon</tt>.
|
94
100
|
def initialize(uid, ipcon)
|
95
|
-
super uid, ipcon
|
101
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
96
102
|
|
97
103
|
@api_version = [2, 0, 0]
|
98
104
|
|
@@ -125,48 +131,55 @@ module Tinkerforge
|
|
125
131
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
126
132
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
127
133
|
|
128
|
-
@callback_formats[CALLBACK_ALL_VALUES] = 'S s S'
|
129
|
-
@callback_formats[CALLBACK_CO2_CONCENTRATION] = 'S'
|
130
|
-
@callback_formats[CALLBACK_TEMPERATURE] = 's'
|
131
|
-
@callback_formats[CALLBACK_HUMIDITY] = 'S'
|
134
|
+
@callback_formats[CALLBACK_ALL_VALUES] = [14, 'S s S']
|
135
|
+
@callback_formats[CALLBACK_CO2_CONCENTRATION] = [10, 'S']
|
136
|
+
@callback_formats[CALLBACK_TEMPERATURE] = [10, 's']
|
137
|
+
@callback_formats[CALLBACK_HUMIDITY] = [10, 'S']
|
132
138
|
|
139
|
+
@ipcon.add_device self
|
133
140
|
end
|
134
141
|
|
135
|
-
# Returns all values measured by the CO2 Bricklet 2.0.
|
136
|
-
# CO2 concentration (in ppm), temperature (in 0.01 °C)
|
137
|
-
# and humidity (in 0.01 %RH).
|
142
|
+
# Returns all values measured by the CO2 Bricklet 2.0.
|
138
143
|
#
|
139
144
|
# If you want to get the values periodically, it is recommended to use the
|
140
145
|
# CALLBACK_ALL_VALUES callback. You can set the callback configuration
|
141
146
|
# with BrickletCO2V2#set_all_values_callback_configuration.
|
147
|
+
#
|
148
|
+
# .. note::
|
149
|
+
# The sensor is able to messure up to 120 °C. However it is only specified up to 70 °C.
|
150
|
+
# Exposing the Bricklet to higher temperatures might result in permanent damage.
|
142
151
|
def get_all_values
|
143
|
-
|
152
|
+
check_validity
|
153
|
+
|
154
|
+
send_request FUNCTION_GET_ALL_VALUES, [], '', 14, 'S s S'
|
144
155
|
end
|
145
156
|
|
146
|
-
# The CO2 concentration (among other things)
|
157
|
+
# The CO2 concentration depends (among other things) on the ambient air pressure.
|
147
158
|
#
|
148
159
|
# To increase the accuracy of the CO2 Bricklet 2.0 you can set the current air pressure.
|
149
160
|
# You use the :ref:`Barometer Bricklet 2.0 <barometer_v2_bricklet>` or the
|
150
161
|
# :ref:`Air Quality Bricklet <air_quality_bricklet>` to get the current air pressure.
|
151
162
|
#
|
152
|
-
# The expected unit of the ambient air pressure value is mbar.
|
153
|
-
#
|
154
163
|
# By default air pressure compensation is disabled. Once you set a value it
|
155
164
|
# will be used for compensation. You can turn the compensation off again by
|
156
165
|
# setting the value to 0.
|
157
166
|
#
|
158
167
|
# It is sufficient to update the value every few minutes.
|
159
168
|
def set_air_pressure(air_pressure)
|
160
|
-
|
169
|
+
check_validity
|
170
|
+
|
171
|
+
send_request FUNCTION_SET_AIR_PRESSURE, [air_pressure], 'S', 8, ''
|
161
172
|
end
|
162
173
|
|
163
174
|
# Returns the ambient air pressure as set by BrickletCO2V2#set_air_pressure.
|
164
175
|
def get_air_pressure
|
165
|
-
|
176
|
+
check_validity
|
177
|
+
|
178
|
+
send_request FUNCTION_GET_AIR_PRESSURE, [], '', 10, 'S'
|
166
179
|
end
|
167
180
|
|
168
|
-
# Sets a temperature offset
|
169
|
-
# the measured temperature by 0.1°C.
|
181
|
+
# Sets a temperature offset. A offset of 10 will decrease
|
182
|
+
# the measured temperature by 0.1 °C.
|
170
183
|
#
|
171
184
|
# If you install this Bricklet into an enclosure and you want to measure the ambient
|
172
185
|
# temperature, you may have to decrease the measured temperature by some value to
|
@@ -184,16 +197,20 @@ module Tinkerforge
|
|
184
197
|
# It is sufficient to set the temperature offset once. The offset is saved in
|
185
198
|
# non-volatile memory and is applied again after a power loss.
|
186
199
|
def set_temperature_offset(offset)
|
187
|
-
|
200
|
+
check_validity
|
201
|
+
|
202
|
+
send_request FUNCTION_SET_TEMPERATURE_OFFSET, [offset], 'S', 8, ''
|
188
203
|
end
|
189
204
|
|
190
205
|
# Returns the temperature offset as set by
|
191
206
|
# BrickletCO2V2#set_temperature_offset.
|
192
207
|
def get_temperature_offset
|
193
|
-
|
208
|
+
check_validity
|
209
|
+
|
210
|
+
send_request FUNCTION_GET_TEMPERATURE_OFFSET, [], '', 10, 'S'
|
194
211
|
end
|
195
212
|
|
196
|
-
# The period
|
213
|
+
# The period is the period with which the CALLBACK_ALL_VALUES
|
197
214
|
# callback is triggered periodically. A value of 0 turns the callback off.
|
198
215
|
#
|
199
216
|
# If the `value has to change`-parameter is set to true, the callback is only
|
@@ -202,29 +219,33 @@ module Tinkerforge
|
|
202
219
|
#
|
203
220
|
# If it is set to false, the callback is continuously triggered with the period,
|
204
221
|
# independent of the value.
|
205
|
-
#
|
206
|
-
# The default value is (0, false).
|
207
222
|
def set_all_values_callback_configuration(period, value_has_to_change)
|
208
|
-
|
223
|
+
check_validity
|
224
|
+
|
225
|
+
send_request FUNCTION_SET_ALL_VALUES_CALLBACK_CONFIGURATION, [period, value_has_to_change], 'L ?', 8, ''
|
209
226
|
end
|
210
227
|
|
211
228
|
# Returns the callback configuration as set by
|
212
229
|
# BrickletCO2V2#set_all_values_callback_configuration.
|
213
230
|
def get_all_values_callback_configuration
|
214
|
-
|
231
|
+
check_validity
|
232
|
+
|
233
|
+
send_request FUNCTION_GET_ALL_VALUES_CALLBACK_CONFIGURATION, [], '', 13, 'L ?'
|
215
234
|
end
|
216
235
|
|
217
|
-
# Returns CO2 concentration
|
236
|
+
# Returns CO2 concentration.
|
218
237
|
#
|
219
238
|
#
|
220
239
|
# If you want to get the value periodically, it is recommended to use the
|
221
240
|
# CALLBACK_CO2_CONCENTRATION callback. You can set the callback configuration
|
222
241
|
# with BrickletCO2V2#set_co2_concentration_callback_configuration.
|
223
242
|
def get_co2_concentration
|
224
|
-
|
243
|
+
check_validity
|
244
|
+
|
245
|
+
send_request FUNCTION_GET_CO2_CONCENTRATION, [], '', 10, 'S'
|
225
246
|
end
|
226
247
|
|
227
|
-
# The period
|
248
|
+
# The period is the period with which the CALLBACK_CO2_CONCENTRATION callback is triggered
|
228
249
|
# periodically. A value of 0 turns the callback off.
|
229
250
|
#
|
230
251
|
# If the `value has to change`-parameter is set to true, the callback is only
|
@@ -249,28 +270,36 @@ module Tinkerforge
|
|
249
270
|
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
250
271
|
#
|
251
272
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
252
|
-
#
|
253
|
-
# The default value is (0, false, 'x', 0, 0).
|
254
273
|
def set_co2_concentration_callback_configuration(period, value_has_to_change, option, min, max)
|
255
|
-
|
274
|
+
check_validity
|
275
|
+
|
276
|
+
send_request FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 8, ''
|
256
277
|
end
|
257
278
|
|
258
279
|
# Returns the callback configuration as set by BrickletCO2V2#set_co2_concentration_callback_configuration.
|
259
280
|
def get_co2_concentration_callback_configuration
|
260
|
-
|
281
|
+
check_validity
|
282
|
+
|
283
|
+
send_request FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k S S'
|
261
284
|
end
|
262
285
|
|
263
|
-
# Returns temperature
|
286
|
+
# Returns temperature.
|
287
|
+
#
|
288
|
+
# .. note::
|
289
|
+
# The sensor is able to messure up to 120 °C. However it is only specified up to 70 °C.
|
290
|
+
# Exposing the Bricklet to higher temperatures might result in permanent damage.
|
264
291
|
#
|
265
292
|
#
|
266
293
|
# If you want to get the value periodically, it is recommended to use the
|
267
294
|
# CALLBACK_TEMPERATURE callback. You can set the callback configuration
|
268
295
|
# with BrickletCO2V2#set_temperature_callback_configuration.
|
269
296
|
def get_temperature
|
270
|
-
|
297
|
+
check_validity
|
298
|
+
|
299
|
+
send_request FUNCTION_GET_TEMPERATURE, [], '', 10, 's'
|
271
300
|
end
|
272
301
|
|
273
|
-
# The period
|
302
|
+
# The period is the period with which the CALLBACK_TEMPERATURE callback is triggered
|
274
303
|
# periodically. A value of 0 turns the callback off.
|
275
304
|
#
|
276
305
|
# If the `value has to change`-parameter is set to true, the callback is only
|
@@ -295,28 +324,32 @@ module Tinkerforge
|
|
295
324
|
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
296
325
|
#
|
297
326
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
298
|
-
#
|
299
|
-
# The default value is (0, false, 'x', 0, 0).
|
300
327
|
def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
|
301
|
-
|
328
|
+
check_validity
|
329
|
+
|
330
|
+
send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 8, ''
|
302
331
|
end
|
303
332
|
|
304
333
|
# Returns the callback configuration as set by BrickletCO2V2#set_temperature_callback_configuration.
|
305
334
|
def get_temperature_callback_configuration
|
306
|
-
|
335
|
+
check_validity
|
336
|
+
|
337
|
+
send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
|
307
338
|
end
|
308
339
|
|
309
|
-
# Returns relative humidity
|
340
|
+
# Returns relative humidity.
|
310
341
|
#
|
311
342
|
#
|
312
343
|
# If you want to get the value periodically, it is recommended to use the
|
313
344
|
# CALLBACK_HUMIDITY callback. You can set the callback configuration
|
314
345
|
# with BrickletCO2V2#set_humidity_callback_configuration.
|
315
346
|
def get_humidity
|
316
|
-
|
347
|
+
check_validity
|
348
|
+
|
349
|
+
send_request FUNCTION_GET_HUMIDITY, [], '', 10, 'S'
|
317
350
|
end
|
318
351
|
|
319
|
-
# The period
|
352
|
+
# The period is the period with which the CALLBACK_HUMIDITY callback is triggered
|
320
353
|
# periodically. A value of 0 turns the callback off.
|
321
354
|
#
|
322
355
|
# If the `value has to change`-parameter is set to true, the callback is only
|
@@ -341,15 +374,17 @@ module Tinkerforge
|
|
341
374
|
# "'>'", "Threshold is triggered when the value is greater than the min value (max is ignored)"
|
342
375
|
#
|
343
376
|
# If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
|
344
|
-
#
|
345
|
-
# The default value is (0, false, 'x', 0, 0).
|
346
377
|
def set_humidity_callback_configuration(period, value_has_to_change, option, min, max)
|
347
|
-
|
378
|
+
check_validity
|
379
|
+
|
380
|
+
send_request FUNCTION_SET_HUMIDITY_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k S S', 8, ''
|
348
381
|
end
|
349
382
|
|
350
383
|
# Returns the callback configuration as set by BrickletCO2V2#set_humidity_callback_configuration.
|
351
384
|
def get_humidity_callback_configuration
|
352
|
-
|
385
|
+
check_validity
|
386
|
+
|
387
|
+
send_request FUNCTION_GET_HUMIDITY_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k S S'
|
353
388
|
end
|
354
389
|
|
355
390
|
# Returns the error count for the communication between Brick and Bricklet.
|
@@ -364,7 +399,9 @@ module Tinkerforge
|
|
364
399
|
# The errors counts are for errors that occur on the Bricklet side. All
|
365
400
|
# Bricks have a similar function that returns the errors on the Brick side.
|
366
401
|
def get_spitfp_error_count
|
367
|
-
|
402
|
+
check_validity
|
403
|
+
|
404
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
368
405
|
end
|
369
406
|
|
370
407
|
# Sets the bootloader mode and returns the status after the requested
|
@@ -377,12 +414,16 @@ module Tinkerforge
|
|
377
414
|
# This function is used by Brick Viewer during flashing. It should not be
|
378
415
|
# necessary to call it in a normal user program.
|
379
416
|
def set_bootloader_mode(mode)
|
380
|
-
|
417
|
+
check_validity
|
418
|
+
|
419
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
381
420
|
end
|
382
421
|
|
383
422
|
# Returns the current bootloader mode, see BrickletCO2V2#set_bootloader_mode.
|
384
423
|
def get_bootloader_mode
|
385
|
-
|
424
|
+
check_validity
|
425
|
+
|
426
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
386
427
|
end
|
387
428
|
|
388
429
|
# Sets the firmware pointer for BrickletCO2V2#write_firmware. The pointer has
|
@@ -392,7 +433,9 @@ module Tinkerforge
|
|
392
433
|
# This function is used by Brick Viewer during flashing. It should not be
|
393
434
|
# necessary to call it in a normal user program.
|
394
435
|
def set_write_firmware_pointer(pointer)
|
395
|
-
|
436
|
+
check_validity
|
437
|
+
|
438
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
396
439
|
end
|
397
440
|
|
398
441
|
# Writes 64 Bytes of firmware at the position as written by
|
@@ -404,7 +447,9 @@ module Tinkerforge
|
|
404
447
|
# This function is used by Brick Viewer during flashing. It should not be
|
405
448
|
# necessary to call it in a normal user program.
|
406
449
|
def write_firmware(data)
|
407
|
-
|
450
|
+
check_validity
|
451
|
+
|
452
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
408
453
|
end
|
409
454
|
|
410
455
|
# Sets the status LED configuration. By default the LED shows
|
@@ -415,22 +460,28 @@ module Tinkerforge
|
|
415
460
|
#
|
416
461
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
417
462
|
def set_status_led_config(config)
|
418
|
-
|
463
|
+
check_validity
|
464
|
+
|
465
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
419
466
|
end
|
420
467
|
|
421
468
|
# Returns the configuration as set by BrickletCO2V2#set_status_led_config
|
422
469
|
def get_status_led_config
|
423
|
-
|
470
|
+
check_validity
|
471
|
+
|
472
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
424
473
|
end
|
425
474
|
|
426
|
-
# Returns the temperature
|
475
|
+
# Returns the temperature as measured inside the microcontroller. The
|
427
476
|
# value returned is not the ambient temperature!
|
428
477
|
#
|
429
478
|
# The temperature is only proportional to the real temperature and it has bad
|
430
479
|
# accuracy. Practically it is only useful as an indicator for
|
431
480
|
# temperature changes.
|
432
481
|
def get_chip_temperature
|
433
|
-
|
482
|
+
check_validity
|
483
|
+
|
484
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
434
485
|
end
|
435
486
|
|
436
487
|
# Calling this function will reset the Bricklet. All configurations
|
@@ -440,7 +491,9 @@ module Tinkerforge
|
|
440
491
|
# calling functions on the existing ones will result in
|
441
492
|
# undefined behavior!
|
442
493
|
def reset
|
443
|
-
|
494
|
+
check_validity
|
495
|
+
|
496
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
444
497
|
end
|
445
498
|
|
446
499
|
# Writes a new UID into flash. If you want to set a new UID
|
@@ -449,25 +502,31 @@ module Tinkerforge
|
|
449
502
|
#
|
450
503
|
# We recommend that you use Brick Viewer to change the UID.
|
451
504
|
def write_uid(uid)
|
452
|
-
|
505
|
+
check_validity
|
506
|
+
|
507
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
453
508
|
end
|
454
509
|
|
455
510
|
# Returns the current UID as an integer. Encode as
|
456
511
|
# Base58 to get the usual string version.
|
457
512
|
def read_uid
|
458
|
-
|
513
|
+
check_validity
|
514
|
+
|
515
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
459
516
|
end
|
460
517
|
|
461
518
|
# Returns the UID, the UID where the Bricklet is connected to,
|
462
519
|
# the position, the hardware and firmware version as well as the
|
463
520
|
# device identifier.
|
464
521
|
#
|
465
|
-
# The position can be 'a', 'b', 'c' or '
|
522
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
523
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
524
|
+
# position 'z'.
|
466
525
|
#
|
467
526
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
468
527
|
# |device_identifier_constant|
|
469
528
|
def get_identity
|
470
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
529
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
471
530
|
end
|
472
531
|
|
473
532
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|