tinkerforge 2.1.24 → 2.1.29
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.
- checksums.yaml +5 -5
- data/lib/tinkerforge/brick_dc.rb +156 -75
- data/lib/tinkerforge/brick_hat.rb +69 -31
- data/lib/tinkerforge/brick_hat_zero.rb +55 -23
- data/lib/tinkerforge/brick_imu.rb +185 -78
- data/lib/tinkerforge/brick_imu_v2.rb +209 -106
- data/lib/tinkerforge/brick_master.rb +491 -183
- data/lib/tinkerforge/brick_red.rb +197 -74
- data/lib/tinkerforge/brick_servo.rb +186 -102
- data/lib/tinkerforge/brick_silent_stepper.rb +247 -167
- data/lib/tinkerforge/brick_stepper.rb +211 -99
- data/lib/tinkerforge/bricklet_accelerometer.rb +57 -23
- data/lib/tinkerforge/bricklet_accelerometer_v2.rb +104 -54
- data/lib/tinkerforge/bricklet_air_quality.rb +116 -59
- data/lib/tinkerforge/bricklet_ambient_light.rb +50 -21
- data/lib/tinkerforge/bricklet_ambient_light_v2.rb +44 -24
- data/lib/tinkerforge/bricklet_ambient_light_v3.rb +65 -27
- data/lib/tinkerforge/bricklet_analog_in.rb +62 -25
- data/lib/tinkerforge/bricklet_analog_in_v2.rb +56 -23
- data/lib/tinkerforge/bricklet_analog_in_v3.rb +66 -25
- data/lib/tinkerforge/bricklet_analog_out.rb +22 -9
- data/lib/tinkerforge/bricklet_analog_out_v2.rb +19 -8
- data/lib/tinkerforge/bricklet_analog_out_v3.rb +53 -20
- data/lib/tinkerforge/bricklet_barometer.rb +100 -27
- data/lib/tinkerforge/bricklet_barometer_v2.rb +98 -37
- data/lib/tinkerforge/bricklet_can.rb +83 -19
- data/lib/tinkerforge/bricklet_can_v2.rb +171 -38
- data/lib/tinkerforge/bricklet_co2.rb +33 -14
- data/lib/tinkerforge/bricklet_co2_v2.rb +97 -38
- data/lib/tinkerforge/bricklet_color.rb +68 -27
- data/lib/tinkerforge/bricklet_color_v2.rb +86 -33
- data/lib/tinkerforge/bricklet_compass.rb +77 -30
- data/lib/tinkerforge/bricklet_current12.rb +57 -24
- data/lib/tinkerforge/bricklet_current25.rb +57 -24
- data/lib/tinkerforge/bricklet_dc_v2.rb +521 -0
- data/lib/tinkerforge/bricklet_distance_ir.rb +56 -23
- data/lib/tinkerforge/bricklet_distance_ir_v2.rb +82 -31
- data/lib/tinkerforge/bricklet_distance_us.rb +39 -16
- data/lib/tinkerforge/bricklet_distance_us_v2.rb +66 -25
- data/lib/tinkerforge/bricklet_dmx.rb +87 -34
- data/lib/tinkerforge/bricklet_dual_button.rb +23 -10
- data/lib/tinkerforge/bricklet_dual_button_v2.rb +63 -24
- data/lib/tinkerforge/bricklet_dual_relay.rb +26 -11
- data/lib/tinkerforge/bricklet_dust_detector.rb +39 -16
- data/lib/tinkerforge/bricklet_e_paper_296x128.rb +87 -32
- data/lib/tinkerforge/bricklet_energy_monitor.rb +72 -27
- data/lib/tinkerforge/bricklet_gps.rb +63 -26
- data/lib/tinkerforge/bricklet_gps_v2.rb +116 -47
- data/lib/tinkerforge/bricklet_hall_effect.rb +42 -23
- data/lib/tinkerforge/bricklet_hall_effect_v2.rb +70 -27
- data/lib/tinkerforge/bricklet_humidity.rb +50 -21
- data/lib/tinkerforge/bricklet_humidity_v2.rb +82 -31
- data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
- data/lib/tinkerforge/bricklet_industrial_analog_out.rb +37 -14
- data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +80 -29
- data/lib/tinkerforge/bricklet_industrial_counter.rb +100 -39
- data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +44 -17
- data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +76 -29
- data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +35 -14
- data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +72 -27
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +39 -16
- data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -30
- data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +48 -19
- data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +137 -31
- data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +60 -23
- data/lib/tinkerforge/bricklet_industrial_ptc.rb +475 -0
- data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +35 -14
- data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +66 -25
- data/lib/tinkerforge/bricklet_io16.rb +54 -21
- data/lib/tinkerforge/bricklet_io16_v2.rb +89 -34
- data/lib/tinkerforge/bricklet_io4.rb +54 -23
- data/lib/tinkerforge/bricklet_io4_v2.rb +95 -36
- data/lib/tinkerforge/bricklet_isolator.rb +72 -29
- data/lib/tinkerforge/bricklet_joystick.rb +58 -25
- data/lib/tinkerforge/bricklet_joystick_v2.rb +67 -26
- data/lib/tinkerforge/bricklet_laser_range_finder.rb +81 -32
- data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +95 -36
- data/lib/tinkerforge/bricklet_lcd_128x64.rb +191 -70
- data/lib/tinkerforge/bricklet_lcd_16x2.rb +44 -18
- data/lib/tinkerforge/bricklet_lcd_20x4.rb +57 -23
- data/lib/tinkerforge/bricklet_led_strip.rb +59 -22
- data/lib/tinkerforge/bricklet_led_strip_v2.rb +90 -46
- data/lib/tinkerforge/bricklet_line.rb +33 -14
- data/lib/tinkerforge/bricklet_linear_poti.rb +50 -21
- data/lib/tinkerforge/bricklet_linear_poti_v2.rb +54 -21
- data/lib/tinkerforge/bricklet_load_cell.rb +60 -23
- data/lib/tinkerforge/bricklet_load_cell_v2.rb +79 -30
- data/lib/tinkerforge/bricklet_moisture.rb +39 -16
- data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
- data/lib/tinkerforge/bricklet_motion_detector_v2.rb +61 -27
- data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +70 -27
- data/lib/tinkerforge/bricklet_multi_touch.rb +30 -13
- data/lib/tinkerforge/bricklet_multi_touch_v2.rb +75 -28
- data/lib/tinkerforge/bricklet_nfc.rb +126 -62
- data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
- data/lib/tinkerforge/bricklet_oled_128x64.rb +28 -11
- data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +65 -24
- data/lib/tinkerforge/bricklet_oled_64x48.rb +28 -11
- data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
- data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -28
- data/lib/tinkerforge/bricklet_particulate_matter.rb +74 -30
- data/lib/tinkerforge/bricklet_performance_dc.rb +682 -0
- data/lib/tinkerforge/bricklet_piezo_buzzer.rb +18 -9
- data/lib/tinkerforge/bricklet_piezo_speaker.rb +21 -10
- data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +79 -42
- data/lib/tinkerforge/bricklet_ptc.rb +73 -42
- data/lib/tinkerforge/bricklet_ptc_v2.rb +94 -48
- data/lib/tinkerforge/bricklet_real_time_clock.rb +44 -33
- data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +77 -44
- 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 +38 -19
- data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +59 -24
- data/lib/tinkerforge/bricklet_rotary_poti.rb +52 -28
- data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +56 -23
- data/lib/tinkerforge/bricklet_rs232.rb +89 -28
- data/lib/tinkerforge/bricklet_rs232_v2.rb +117 -44
- data/lib/tinkerforge/bricklet_rs485.rb +222 -95
- data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
- data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +74 -35
- data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
- data/lib/tinkerforge/bricklet_silent_stepper_v2.rb +1024 -0
- 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 +34 -18
- data/lib/tinkerforge/bricklet_sound_pressure_level.rb +71 -31
- data/lib/tinkerforge/bricklet_temperature.rb +39 -16
- data/lib/tinkerforge/bricklet_temperature_ir.rb +56 -23
- data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +70 -27
- data/lib/tinkerforge/bricklet_temperature_v2.rb +60 -25
- data/lib/tinkerforge/bricklet_thermal_imaging.rb +104 -44
- data/lib/tinkerforge/bricklet_thermocouple.rb +44 -24
- data/lib/tinkerforge/bricklet_thermocouple_v2.rb +64 -27
- data/lib/tinkerforge/bricklet_tilt.rb +23 -10
- data/lib/tinkerforge/bricklet_uv_light.rb +35 -18
- data/lib/tinkerforge/bricklet_uv_light_v2.rb +84 -37
- data/lib/tinkerforge/bricklet_voltage.rb +51 -28
- data/lib/tinkerforge/bricklet_voltage_current.rb +90 -73
- data/lib/tinkerforge/bricklet_voltage_current_v2.rb +89 -68
- data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +79 -30
- data/lib/tinkerforge/device_display_names.rb +170 -0
- data/lib/tinkerforge/ip_connection.rb +153 -33
- data/lib/tinkerforge/version.rb +1 -1
- metadata +11 -3
|
@@ -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 2021-05-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.29 #
|
|
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
|
# Creates 1kHz beep
|
|
14
16
|
class BrickletPiezoBuzzer < Device
|
|
@@ -30,7 +32,7 @@ module Tinkerforge
|
|
|
30
32
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
31
33
|
# the IP Connection <tt>ipcon</tt>.
|
|
32
34
|
def initialize(uid, ipcon)
|
|
33
|
-
super uid, ipcon
|
|
35
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
34
36
|
|
|
35
37
|
@api_version = [2, 0, 0]
|
|
36
38
|
|
|
@@ -38,14 +40,17 @@ module Tinkerforge
|
|
|
38
40
|
@response_expected[FUNCTION_MORSE_CODE] = RESPONSE_EXPECTED_FALSE
|
|
39
41
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
40
42
|
|
|
41
|
-
@callback_formats[CALLBACK_BEEP_FINISHED] = ''
|
|
42
|
-
@callback_formats[CALLBACK_MORSE_CODE_FINISHED] = ''
|
|
43
|
+
@callback_formats[CALLBACK_BEEP_FINISHED] = [8, '']
|
|
44
|
+
@callback_formats[CALLBACK_MORSE_CODE_FINISHED] = [8, '']
|
|
43
45
|
|
|
46
|
+
@ipcon.add_device self
|
|
44
47
|
end
|
|
45
48
|
|
|
46
49
|
# Beeps for the given duration.
|
|
47
50
|
def beep(duration)
|
|
48
|
-
|
|
51
|
+
check_validity
|
|
52
|
+
|
|
53
|
+
send_request FUNCTION_BEEP, [duration], 'L', 8, ''
|
|
49
54
|
end
|
|
50
55
|
|
|
51
56
|
# Sets morse code that will be played by the piezo buzzer. The morse code
|
|
@@ -56,19 +61,23 @@ module Tinkerforge
|
|
|
56
61
|
# nine times with the durations "short short short long long long short
|
|
57
62
|
# short short".
|
|
58
63
|
def morse_code(morse)
|
|
59
|
-
|
|
64
|
+
check_validity
|
|
65
|
+
|
|
66
|
+
send_request FUNCTION_MORSE_CODE, [morse], 'Z60', 8, ''
|
|
60
67
|
end
|
|
61
68
|
|
|
62
69
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
63
70
|
# the position, the hardware and firmware version as well as the
|
|
64
71
|
# device identifier.
|
|
65
72
|
#
|
|
66
|
-
# The position can be 'a', 'b', 'c' or '
|
|
73
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
74
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
75
|
+
# position 'z'.
|
|
67
76
|
#
|
|
68
77
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
69
78
|
# |device_identifier_constant|
|
|
70
79
|
def get_identity
|
|
71
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
80
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
72
81
|
end
|
|
73
82
|
|
|
74
83
|
# 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 2021-05-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.29 #
|
|
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
|
# Creates beep with configurable frequency
|
|
14
16
|
class BrickletPiezoSpeaker < Device
|
|
@@ -33,7 +35,7 @@ module Tinkerforge
|
|
|
33
35
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
34
36
|
# the IP Connection <tt>ipcon</tt>.
|
|
35
37
|
def initialize(uid, ipcon)
|
|
36
|
-
super uid, ipcon
|
|
38
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
37
39
|
|
|
38
40
|
@api_version = [2, 0, 0]
|
|
39
41
|
|
|
@@ -42,9 +44,10 @@ module Tinkerforge
|
|
|
42
44
|
@response_expected[FUNCTION_CALIBRATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
43
45
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
44
46
|
|
|
45
|
-
@callback_formats[CALLBACK_BEEP_FINISHED] = ''
|
|
46
|
-
@callback_formats[CALLBACK_MORSE_CODE_FINISHED] = ''
|
|
47
|
+
@callback_formats[CALLBACK_BEEP_FINISHED] = [8, '']
|
|
48
|
+
@callback_formats[CALLBACK_MORSE_CODE_FINISHED] = [8, '']
|
|
47
49
|
|
|
50
|
+
@ipcon.add_device self
|
|
48
51
|
end
|
|
49
52
|
|
|
50
53
|
# Beeps with the given frequency for the given duration.
|
|
@@ -56,7 +59,9 @@ module Tinkerforge
|
|
|
56
59
|
# The Piezo Speaker Bricklet can only approximate the frequency, it will play
|
|
57
60
|
# the best possible match by applying the calibration (see BrickletPiezoSpeaker#calibrate).
|
|
58
61
|
def beep(duration, frequency)
|
|
59
|
-
|
|
62
|
+
check_validity
|
|
63
|
+
|
|
64
|
+
send_request FUNCTION_BEEP, [duration, frequency], 'L S', 8, ''
|
|
60
65
|
end
|
|
61
66
|
|
|
62
67
|
# Sets morse code that will be played by the piezo buzzer. The morse code
|
|
@@ -67,7 +72,9 @@ module Tinkerforge
|
|
|
67
72
|
# nine times with the durations "short short short long long long short
|
|
68
73
|
# short short".
|
|
69
74
|
def morse_code(morse, frequency)
|
|
70
|
-
|
|
75
|
+
check_validity
|
|
76
|
+
|
|
77
|
+
send_request FUNCTION_MORSE_CODE, [morse, frequency], 'Z60 S', 8, ''
|
|
71
78
|
end
|
|
72
79
|
|
|
73
80
|
# The Piezo Speaker Bricklet can play 512 different tones. This function
|
|
@@ -80,19 +87,23 @@ module Tinkerforge
|
|
|
80
87
|
#
|
|
81
88
|
# Returns *true* after the calibration finishes.
|
|
82
89
|
def calibrate
|
|
83
|
-
|
|
90
|
+
check_validity
|
|
91
|
+
|
|
92
|
+
send_request FUNCTION_CALIBRATE, [], '', 9, '?'
|
|
84
93
|
end
|
|
85
94
|
|
|
86
95
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
87
96
|
# the position, the hardware and firmware version as well as the
|
|
88
97
|
# device identifier.
|
|
89
98
|
#
|
|
90
|
-
# The position can be 'a', 'b', 'c' or '
|
|
99
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
100
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
101
|
+
# position 'z'.
|
|
91
102
|
#
|
|
92
103
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
93
104
|
# |device_identifier_constant|
|
|
94
105
|
def get_identity
|
|
95
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
106
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
96
107
|
end
|
|
97
108
|
|
|
98
109
|
# 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 2021-05-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.29 #
|
|
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
|
# Creates beep and alarm with configurable volume and frequency
|
|
14
16
|
class BrickletPiezoSpeakerV2 < Device
|
|
@@ -63,7 +65,7 @@ module Tinkerforge
|
|
|
63
65
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
64
66
|
# the IP Connection <tt>ipcon</tt>.
|
|
65
67
|
def initialize(uid, ipcon)
|
|
66
|
-
super uid, ipcon
|
|
68
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
67
69
|
|
|
68
70
|
@api_version = [2, 0, 0]
|
|
69
71
|
|
|
@@ -86,9 +88,10 @@ module Tinkerforge
|
|
|
86
88
|
@response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
87
89
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
88
90
|
|
|
89
|
-
@callback_formats[CALLBACK_BEEP_FINISHED] = ''
|
|
90
|
-
@callback_formats[CALLBACK_ALARM_FINISHED] = ''
|
|
91
|
+
@callback_formats[CALLBACK_BEEP_FINISHED] = [8, '']
|
|
92
|
+
@callback_formats[CALLBACK_ALARM_FINISHED] = [8, '']
|
|
91
93
|
|
|
94
|
+
@ipcon.add_device self
|
|
92
95
|
end
|
|
93
96
|
|
|
94
97
|
# Beeps with the given frequency and volume for the duration.
|
|
@@ -96,7 +99,9 @@ module Tinkerforge
|
|
|
96
99
|
# A duration of 0 stops the current beep if any is ongoing.
|
|
97
100
|
# A duration of 4294967295 results in an infinite beep.
|
|
98
101
|
def set_beep(frequency, volume, duration)
|
|
99
|
-
|
|
102
|
+
check_validity
|
|
103
|
+
|
|
104
|
+
send_request FUNCTION_SET_BEEP, [frequency, volume, duration], 'S C L', 8, ''
|
|
100
105
|
end
|
|
101
106
|
|
|
102
107
|
# Returns the last beep settings as set by BrickletPiezoSpeakerV2#set_beep. If a beep is currently
|
|
@@ -105,18 +110,20 @@ module Tinkerforge
|
|
|
105
110
|
# If the frequency or volume is updated during a beep (with BrickletPiezoSpeakerV2#update_frequency
|
|
106
111
|
# or BrickletPiezoSpeakerV2#update_volume) this function returns the updated value.
|
|
107
112
|
def get_beep
|
|
108
|
-
|
|
113
|
+
check_validity
|
|
114
|
+
|
|
115
|
+
send_request FUNCTION_GET_BEEP, [], '', 19, 'S C L L'
|
|
109
116
|
end
|
|
110
117
|
|
|
111
118
|
# Creates an alarm (a tone that goes back and force between two specified frequencies).
|
|
112
119
|
#
|
|
113
120
|
# The following parameters can be set:
|
|
114
121
|
#
|
|
115
|
-
# * Start Frequency: Start frequency of the alarm
|
|
116
|
-
# * End Frequency: End frequency of the alarm
|
|
117
|
-
# * Step Size: Size of one step of the sweep between the start/end frequencies
|
|
118
|
-
# * Step Delay: Delay between two steps (duration of time that one tone is used in a sweep)
|
|
119
|
-
# * Duration: Duration of the alarm
|
|
122
|
+
# * Start Frequency: Start frequency of the alarm.
|
|
123
|
+
# * End Frequency: End frequency of the alarm.
|
|
124
|
+
# * Step Size: Size of one step of the sweep between the start/end frequencies.
|
|
125
|
+
# * Step Delay: Delay between two steps (duration of time that one tone is used in a sweep).
|
|
126
|
+
# * Duration: Duration of the alarm.
|
|
120
127
|
#
|
|
121
128
|
# A duration of 0 stops the current alarm if any is ongoing.
|
|
122
129
|
# A duration of 4294967295 results in an infinite alarm.
|
|
@@ -142,36 +149,42 @@ module Tinkerforge
|
|
|
142
149
|
# * Volume = 0
|
|
143
150
|
# * Duration = 10000
|
|
144
151
|
#
|
|
145
|
-
# The
|
|
152
|
+
# The following conditions must be met:
|
|
146
153
|
#
|
|
147
|
-
# * Start Frequency:
|
|
148
|
-
# * End Frequency:
|
|
149
|
-
# * Step Size:
|
|
150
|
-
# * Step Delay:
|
|
151
|
-
# * Volume: 0 - 10
|
|
152
|
-
# * Duration: 0ms - 4294967295ms
|
|
154
|
+
# * Start Frequency: has to be smaller than end frequency
|
|
155
|
+
# * End Frequency: has to be bigger than start frequency
|
|
156
|
+
# * Step Size: has to be small enough to fit into the frequency range
|
|
157
|
+
# * Step Delay: has to be small enough to fit into the duration
|
|
153
158
|
def set_alarm(start_frequency, end_frequency, step_size, step_delay, volume, duration)
|
|
154
|
-
|
|
159
|
+
check_validity
|
|
160
|
+
|
|
161
|
+
send_request FUNCTION_SET_ALARM, [start_frequency, end_frequency, step_size, step_delay, volume, duration], 'S S S S C L', 8, ''
|
|
155
162
|
end
|
|
156
163
|
|
|
157
164
|
# Returns the last alarm settings as set by BrickletPiezoSpeakerV2#set_alarm. If an alarm is currently
|
|
158
|
-
# running it also returns the remaining duration of the alarm
|
|
159
|
-
# current frequency of the alarm
|
|
165
|
+
# running it also returns the remaining duration of the alarm as well as the
|
|
166
|
+
# current frequency of the alarm.
|
|
160
167
|
#
|
|
161
|
-
# If the volume is updated during
|
|
168
|
+
# If the volume is updated during an alarm (with BrickletPiezoSpeakerV2#update_volume)
|
|
162
169
|
# this function returns the updated value.
|
|
163
170
|
def get_alarm
|
|
164
|
-
|
|
171
|
+
check_validity
|
|
172
|
+
|
|
173
|
+
send_request FUNCTION_GET_ALARM, [], '', 27, 'S S S S C L L S'
|
|
165
174
|
end
|
|
166
175
|
|
|
167
|
-
# Updates the volume of an ongoing beep or alarm.
|
|
176
|
+
# Updates the volume of an ongoing beep or alarm.
|
|
168
177
|
def update_volume(volume)
|
|
169
|
-
|
|
178
|
+
check_validity
|
|
179
|
+
|
|
180
|
+
send_request FUNCTION_UPDATE_VOLUME, [volume], 'C', 8, ''
|
|
170
181
|
end
|
|
171
182
|
|
|
172
|
-
# Updates the frequency of an ongoing beep.
|
|
183
|
+
# Updates the frequency of an ongoing beep.
|
|
173
184
|
def update_frequency(frequency)
|
|
174
|
-
|
|
185
|
+
check_validity
|
|
186
|
+
|
|
187
|
+
send_request FUNCTION_UPDATE_FREQUENCY, [frequency], 'S', 8, ''
|
|
175
188
|
end
|
|
176
189
|
|
|
177
190
|
# Returns the error count for the communication between Brick and Bricklet.
|
|
@@ -186,7 +199,9 @@ module Tinkerforge
|
|
|
186
199
|
# The errors counts are for errors that occur on the Bricklet side. All
|
|
187
200
|
# Bricks have a similar function that returns the errors on the Brick side.
|
|
188
201
|
def get_spitfp_error_count
|
|
189
|
-
|
|
202
|
+
check_validity
|
|
203
|
+
|
|
204
|
+
send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
|
|
190
205
|
end
|
|
191
206
|
|
|
192
207
|
# Sets the bootloader mode and returns the status after the requested
|
|
@@ -199,12 +214,16 @@ module Tinkerforge
|
|
|
199
214
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
200
215
|
# necessary to call it in a normal user program.
|
|
201
216
|
def set_bootloader_mode(mode)
|
|
202
|
-
|
|
217
|
+
check_validity
|
|
218
|
+
|
|
219
|
+
send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
|
|
203
220
|
end
|
|
204
221
|
|
|
205
222
|
# Returns the current bootloader mode, see BrickletPiezoSpeakerV2#set_bootloader_mode.
|
|
206
223
|
def get_bootloader_mode
|
|
207
|
-
|
|
224
|
+
check_validity
|
|
225
|
+
|
|
226
|
+
send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
|
|
208
227
|
end
|
|
209
228
|
|
|
210
229
|
# Sets the firmware pointer for BrickletPiezoSpeakerV2#write_firmware. The pointer has
|
|
@@ -214,7 +233,9 @@ module Tinkerforge
|
|
|
214
233
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
215
234
|
# necessary to call it in a normal user program.
|
|
216
235
|
def set_write_firmware_pointer(pointer)
|
|
217
|
-
|
|
236
|
+
check_validity
|
|
237
|
+
|
|
238
|
+
send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
|
|
218
239
|
end
|
|
219
240
|
|
|
220
241
|
# Writes 64 Bytes of firmware at the position as written by
|
|
@@ -226,7 +247,9 @@ module Tinkerforge
|
|
|
226
247
|
# This function is used by Brick Viewer during flashing. It should not be
|
|
227
248
|
# necessary to call it in a normal user program.
|
|
228
249
|
def write_firmware(data)
|
|
229
|
-
|
|
250
|
+
check_validity
|
|
251
|
+
|
|
252
|
+
send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
|
|
230
253
|
end
|
|
231
254
|
|
|
232
255
|
# Sets the status LED configuration. By default the LED shows
|
|
@@ -237,22 +260,28 @@ module Tinkerforge
|
|
|
237
260
|
#
|
|
238
261
|
# If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
|
|
239
262
|
def set_status_led_config(config)
|
|
240
|
-
|
|
263
|
+
check_validity
|
|
264
|
+
|
|
265
|
+
send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
|
|
241
266
|
end
|
|
242
267
|
|
|
243
268
|
# Returns the configuration as set by BrickletPiezoSpeakerV2#set_status_led_config
|
|
244
269
|
def get_status_led_config
|
|
245
|
-
|
|
270
|
+
check_validity
|
|
271
|
+
|
|
272
|
+
send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
|
|
246
273
|
end
|
|
247
274
|
|
|
248
|
-
# Returns the temperature
|
|
275
|
+
# Returns the temperature as measured inside the microcontroller. The
|
|
249
276
|
# value returned is not the ambient temperature!
|
|
250
277
|
#
|
|
251
278
|
# The temperature is only proportional to the real temperature and it has bad
|
|
252
279
|
# accuracy. Practically it is only useful as an indicator for
|
|
253
280
|
# temperature changes.
|
|
254
281
|
def get_chip_temperature
|
|
255
|
-
|
|
282
|
+
check_validity
|
|
283
|
+
|
|
284
|
+
send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
|
|
256
285
|
end
|
|
257
286
|
|
|
258
287
|
# Calling this function will reset the Bricklet. All configurations
|
|
@@ -262,7 +291,9 @@ module Tinkerforge
|
|
|
262
291
|
# calling functions on the existing ones will result in
|
|
263
292
|
# undefined behavior!
|
|
264
293
|
def reset
|
|
265
|
-
|
|
294
|
+
check_validity
|
|
295
|
+
|
|
296
|
+
send_request FUNCTION_RESET, [], '', 8, ''
|
|
266
297
|
end
|
|
267
298
|
|
|
268
299
|
# Writes a new UID into flash. If you want to set a new UID
|
|
@@ -271,25 +302,31 @@ module Tinkerforge
|
|
|
271
302
|
#
|
|
272
303
|
# We recommend that you use Brick Viewer to change the UID.
|
|
273
304
|
def write_uid(uid)
|
|
274
|
-
|
|
305
|
+
check_validity
|
|
306
|
+
|
|
307
|
+
send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
|
|
275
308
|
end
|
|
276
309
|
|
|
277
310
|
# Returns the current UID as an integer. Encode as
|
|
278
311
|
# Base58 to get the usual string version.
|
|
279
312
|
def read_uid
|
|
280
|
-
|
|
313
|
+
check_validity
|
|
314
|
+
|
|
315
|
+
send_request FUNCTION_READ_UID, [], '', 12, 'L'
|
|
281
316
|
end
|
|
282
317
|
|
|
283
318
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
284
319
|
# the position, the hardware and firmware version as well as the
|
|
285
320
|
# device identifier.
|
|
286
321
|
#
|
|
287
|
-
# The position can be 'a', 'b', 'c' or '
|
|
322
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
323
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
324
|
+
# position 'z'.
|
|
288
325
|
#
|
|
289
326
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
290
327
|
# |device_identifier_constant|
|
|
291
328
|
def get_identity
|
|
292
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
329
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
293
330
|
end
|
|
294
331
|
|
|
295
332
|
# 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 2021-05-06. #
|
|
4
4
|
# #
|
|
5
|
-
# Ruby Bindings Version 2.1.
|
|
5
|
+
# Ruby Bindings Version 2.1.29 #
|
|
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
|
# Reads temperatures from Pt100 und Pt1000 sensors
|
|
14
16
|
class BrickletPTC < Device
|
|
@@ -90,7 +92,7 @@ module Tinkerforge
|
|
|
90
92
|
# Creates an object with the unique device ID <tt>uid</tt> and adds it to
|
|
91
93
|
# the IP Connection <tt>ipcon</tt>.
|
|
92
94
|
def initialize(uid, ipcon)
|
|
93
|
-
super uid, ipcon
|
|
95
|
+
super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
|
|
94
96
|
|
|
95
97
|
@api_version = [2, 0, 1]
|
|
96
98
|
|
|
@@ -115,23 +117,24 @@ module Tinkerforge
|
|
|
115
117
|
@response_expected[FUNCTION_GET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
116
118
|
@response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
|
|
117
119
|
|
|
118
|
-
@callback_formats[CALLBACK_TEMPERATURE] = 'l'
|
|
119
|
-
@callback_formats[CALLBACK_TEMPERATURE_REACHED] = 'l'
|
|
120
|
-
@callback_formats[CALLBACK_RESISTANCE] = 'l'
|
|
121
|
-
@callback_formats[CALLBACK_RESISTANCE_REACHED] = 'l'
|
|
122
|
-
@callback_formats[CALLBACK_SENSOR_CONNECTED] = '?'
|
|
120
|
+
@callback_formats[CALLBACK_TEMPERATURE] = [12, 'l']
|
|
121
|
+
@callback_formats[CALLBACK_TEMPERATURE_REACHED] = [12, 'l']
|
|
122
|
+
@callback_formats[CALLBACK_RESISTANCE] = [12, 'l']
|
|
123
|
+
@callback_formats[CALLBACK_RESISTANCE_REACHED] = [12, 'l']
|
|
124
|
+
@callback_formats[CALLBACK_SENSOR_CONNECTED] = [9, '?']
|
|
123
125
|
|
|
126
|
+
@ipcon.add_device self
|
|
124
127
|
end
|
|
125
128
|
|
|
126
|
-
# Returns the temperature of connected sensor.
|
|
127
|
-
# has a range of -246 to 849 °C and is given in °C/100,
|
|
128
|
-
# e.g. a value of 4223 means that a temperature of 42.23 °C is measured.
|
|
129
|
+
# Returns the temperature of connected sensor.
|
|
129
130
|
#
|
|
130
131
|
# If you want to get the temperature periodically, it is recommended
|
|
131
132
|
# to use the CALLBACK_TEMPERATURE callback and set the period with
|
|
132
133
|
# BrickletPTC#set_temperature_callback_period.
|
|
133
134
|
def get_temperature
|
|
134
|
-
|
|
135
|
+
check_validity
|
|
136
|
+
|
|
137
|
+
send_request FUNCTION_GET_TEMPERATURE, [], '', 12, 'l'
|
|
135
138
|
end
|
|
136
139
|
|
|
137
140
|
# Returns the value as measured by the MAX31865 precision delta-sigma ADC.
|
|
@@ -145,7 +148,9 @@ module Tinkerforge
|
|
|
145
148
|
# to use the CALLBACK_RESISTANCE callback and set the period with
|
|
146
149
|
# BrickletPTC#set_resistance_callback_period.
|
|
147
150
|
def get_resistance
|
|
148
|
-
|
|
151
|
+
check_validity
|
|
152
|
+
|
|
153
|
+
send_request FUNCTION_GET_RESISTANCE, [], '', 12, 'l'
|
|
149
154
|
end
|
|
150
155
|
|
|
151
156
|
# Sets the period with which the CALLBACK_TEMPERATURE callback is triggered
|
|
@@ -154,12 +159,16 @@ module Tinkerforge
|
|
|
154
159
|
# The CALLBACK_TEMPERATURE callback is only triggered if the temperature has
|
|
155
160
|
# changed since the last triggering.
|
|
156
161
|
def set_temperature_callback_period(period)
|
|
157
|
-
|
|
162
|
+
check_validity
|
|
163
|
+
|
|
164
|
+
send_request FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
158
165
|
end
|
|
159
166
|
|
|
160
167
|
# Returns the period as set by BrickletPTC#set_temperature_callback_period.
|
|
161
168
|
def get_temperature_callback_period
|
|
162
|
-
|
|
169
|
+
check_validity
|
|
170
|
+
|
|
171
|
+
send_request FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
163
172
|
end
|
|
164
173
|
|
|
165
174
|
# Sets the period with which the CALLBACK_RESISTANCE callback is triggered
|
|
@@ -168,12 +177,16 @@ module Tinkerforge
|
|
|
168
177
|
# The CALLBACK_RESISTANCE callback is only triggered if the resistance has changed
|
|
169
178
|
# since the last triggering.
|
|
170
179
|
def set_resistance_callback_period(period)
|
|
171
|
-
|
|
180
|
+
check_validity
|
|
181
|
+
|
|
182
|
+
send_request FUNCTION_SET_RESISTANCE_CALLBACK_PERIOD, [period], 'L', 8, ''
|
|
172
183
|
end
|
|
173
184
|
|
|
174
185
|
# Returns the period as set by BrickletPTC#set_resistance_callback_period.
|
|
175
186
|
def get_resistance_callback_period
|
|
176
|
-
|
|
187
|
+
check_validity
|
|
188
|
+
|
|
189
|
+
send_request FUNCTION_GET_RESISTANCE_CALLBACK_PERIOD, [], '', 12, 'L'
|
|
177
190
|
end
|
|
178
191
|
|
|
179
192
|
# Sets the thresholds for the CALLBACK_TEMPERATURE_REACHED callback.
|
|
@@ -187,15 +200,17 @@ module Tinkerforge
|
|
|
187
200
|
# "'i'", "Callback is triggered when the temperature is *inside* the min and max values"
|
|
188
201
|
# "'<'", "Callback is triggered when the temperature is smaller than the min value (max is ignored)"
|
|
189
202
|
# "'>'", "Callback is triggered when the temperature is greater than the min value (max is ignored)"
|
|
190
|
-
#
|
|
191
|
-
# The default value is ('x', 0, 0).
|
|
192
203
|
def set_temperature_callback_threshold(option, min, max)
|
|
193
|
-
|
|
204
|
+
check_validity
|
|
205
|
+
|
|
206
|
+
send_request FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 8, ''
|
|
194
207
|
end
|
|
195
208
|
|
|
196
209
|
# Returns the threshold as set by BrickletPTC#set_temperature_callback_threshold.
|
|
197
210
|
def get_temperature_callback_threshold
|
|
198
|
-
|
|
211
|
+
check_validity
|
|
212
|
+
|
|
213
|
+
send_request FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD, [], '', 17, 'k l l'
|
|
199
214
|
end
|
|
200
215
|
|
|
201
216
|
# Sets the thresholds for the CALLBACK_RESISTANCE_REACHED callback.
|
|
@@ -209,15 +224,17 @@ module Tinkerforge
|
|
|
209
224
|
# "'i'", "Callback is triggered when the temperature is *inside* the min and max values"
|
|
210
225
|
# "'<'", "Callback is triggered when the temperature is smaller than the min value (max is ignored)"
|
|
211
226
|
# "'>'", "Callback is triggered when the temperature is greater than the min value (max is ignored)"
|
|
212
|
-
#
|
|
213
|
-
# The default value is ('x', 0, 0).
|
|
214
227
|
def set_resistance_callback_threshold(option, min, max)
|
|
215
|
-
|
|
228
|
+
check_validity
|
|
229
|
+
|
|
230
|
+
send_request FUNCTION_SET_RESISTANCE_CALLBACK_THRESHOLD, [option, min, max], 'k l l', 8, ''
|
|
216
231
|
end
|
|
217
232
|
|
|
218
233
|
# Returns the threshold as set by BrickletPTC#set_resistance_callback_threshold.
|
|
219
234
|
def get_resistance_callback_threshold
|
|
220
|
-
|
|
235
|
+
check_validity
|
|
236
|
+
|
|
237
|
+
send_request FUNCTION_GET_RESISTANCE_CALLBACK_THRESHOLD, [], '', 17, 'k l l'
|
|
221
238
|
end
|
|
222
239
|
|
|
223
240
|
# Sets the period with which the threshold callback
|
|
@@ -232,28 +249,34 @@ module Tinkerforge
|
|
|
232
249
|
#
|
|
233
250
|
# keeps being reached.
|
|
234
251
|
def set_debounce_period(debounce)
|
|
235
|
-
|
|
252
|
+
check_validity
|
|
253
|
+
|
|
254
|
+
send_request FUNCTION_SET_DEBOUNCE_PERIOD, [debounce], 'L', 8, ''
|
|
236
255
|
end
|
|
237
256
|
|
|
238
257
|
# Returns the debounce period as set by BrickletPTC#set_debounce_period.
|
|
239
258
|
def get_debounce_period
|
|
240
|
-
|
|
259
|
+
check_validity
|
|
260
|
+
|
|
261
|
+
send_request FUNCTION_GET_DEBOUNCE_PERIOD, [], '', 12, 'L'
|
|
241
262
|
end
|
|
242
263
|
|
|
243
264
|
# Sets the noise rejection filter to either 50Hz (0) or 60Hz (1).
|
|
244
265
|
# Noise from 50Hz or 60Hz power sources (including
|
|
245
266
|
# harmonics of the AC power's fundamental frequency) is
|
|
246
267
|
# attenuated by 82dB.
|
|
247
|
-
#
|
|
248
|
-
# Default value is 0 = 50Hz.
|
|
249
268
|
def set_noise_rejection_filter(filter)
|
|
250
|
-
|
|
269
|
+
check_validity
|
|
270
|
+
|
|
271
|
+
send_request FUNCTION_SET_NOISE_REJECTION_FILTER, [filter], 'C', 8, ''
|
|
251
272
|
end
|
|
252
273
|
|
|
253
274
|
# Returns the noise rejection filter option as set by
|
|
254
275
|
# BrickletPTC#set_noise_rejection_filter
|
|
255
276
|
def get_noise_rejection_filter
|
|
256
|
-
|
|
277
|
+
check_validity
|
|
278
|
+
|
|
279
|
+
send_request FUNCTION_GET_NOISE_REJECTION_FILTER, [], '', 9, 'C'
|
|
257
280
|
end
|
|
258
281
|
|
|
259
282
|
# Returns *true* if the sensor is connected correctly.
|
|
@@ -262,50 +285,58 @@ module Tinkerforge
|
|
|
262
285
|
# returns *false*, there is either no Pt100 or Pt1000 sensor connected,
|
|
263
286
|
# the sensor is connected incorrectly or the sensor itself is faulty.
|
|
264
287
|
def is_sensor_connected
|
|
265
|
-
|
|
288
|
+
check_validity
|
|
289
|
+
|
|
290
|
+
send_request FUNCTION_IS_SENSOR_CONNECTED, [], '', 9, '?'
|
|
266
291
|
end
|
|
267
292
|
|
|
268
293
|
# Sets the wire mode of the sensor. Possible values are 2, 3 and 4 which
|
|
269
294
|
# correspond to 2-, 3- and 4-wire sensors. The value has to match the jumper
|
|
270
295
|
# configuration on the Bricklet.
|
|
271
|
-
#
|
|
272
|
-
# The default value is 2 = 2-wire.
|
|
273
296
|
def set_wire_mode(mode)
|
|
274
|
-
|
|
297
|
+
check_validity
|
|
298
|
+
|
|
299
|
+
send_request FUNCTION_SET_WIRE_MODE, [mode], 'C', 8, ''
|
|
275
300
|
end
|
|
276
301
|
|
|
277
302
|
# Returns the wire mode as set by BrickletPTC#set_wire_mode
|
|
278
303
|
def get_wire_mode
|
|
279
|
-
|
|
304
|
+
check_validity
|
|
305
|
+
|
|
306
|
+
send_request FUNCTION_GET_WIRE_MODE, [], '', 9, 'C'
|
|
280
307
|
end
|
|
281
308
|
|
|
282
309
|
# If you enable this callback, the CALLBACK_SENSOR_CONNECTED callback is triggered
|
|
283
310
|
# every time a Pt sensor is connected/disconnected.
|
|
284
311
|
#
|
|
285
|
-
# By default this callback is disabled.
|
|
286
|
-
#
|
|
287
312
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
288
313
|
def set_sensor_connected_callback_configuration(enabled)
|
|
289
|
-
|
|
314
|
+
check_validity
|
|
315
|
+
|
|
316
|
+
send_request FUNCTION_SET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION, [enabled], '?', 8, ''
|
|
290
317
|
end
|
|
291
318
|
|
|
292
319
|
# Returns the configuration as set by BrickletPTC#set_sensor_connected_callback_configuration.
|
|
293
320
|
#
|
|
294
321
|
# .. versionadded:: 2.0.2$nbsp;(Plugin)
|
|
295
322
|
def get_sensor_connected_callback_configuration
|
|
296
|
-
|
|
323
|
+
check_validity
|
|
324
|
+
|
|
325
|
+
send_request FUNCTION_GET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION, [], '', 9, '?'
|
|
297
326
|
end
|
|
298
327
|
|
|
299
328
|
# Returns the UID, the UID where the Bricklet is connected to,
|
|
300
329
|
# the position, the hardware and firmware version as well as the
|
|
301
330
|
# device identifier.
|
|
302
331
|
#
|
|
303
|
-
# The position can be 'a', 'b', 'c' or '
|
|
332
|
+
# The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
|
|
333
|
+
# A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
|
|
334
|
+
# position 'z'.
|
|
304
335
|
#
|
|
305
336
|
# The device identifier numbers can be found :ref:`here <device_identifier>`.
|
|
306
337
|
# |device_identifier_constant|
|
|
307
338
|
def get_identity
|
|
308
|
-
send_request FUNCTION_GET_IDENTITY, [], '',
|
|
339
|
+
send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
|
|
309
340
|
end
|
|
310
341
|
|
|
311
342
|
# Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
|