tinderfridge 0.2.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tinderfridge/device.rb +95 -1
- data/lib/tinderfridge/device_collection.rb +69 -0
- data/lib/tinderfridge/device_info.txt +5 -0
- data/lib/tinderfridge/devices/brick_hat/brick_hat.json +11 -0
- data/lib/tinderfridge/devices/brick_hat/brick_hat.rb +18 -0
- data/lib/tinderfridge/devices/brick_hat_zero/brick_hat_zero.json +11 -0
- data/lib/tinderfridge/devices/brick_hat_zero/brick_hat_zero.rb +14 -0
- data/lib/tinderfridge/devices/bricklet_air_quality/bricklet_air_quality.json +10 -0
- data/lib/tinderfridge/devices/bricklet_air_quality/bricklet_air_quality.rb +20 -0
- data/lib/tinderfridge/devices/bricklet_ambient_light_v3/bricklet_ambient_light_v3.json +10 -0
- data/lib/tinderfridge/devices/bricklet_ambient_light_v3/bricklet_ambient_light_v3.rb +19 -0
- data/lib/tinderfridge/devices/bricklet_analog_in_v3/bricklet_analog_in_v3.json +10 -0
- data/lib/tinderfridge/devices/bricklet_analog_out_v3/bricklet_analog_out_v3.json +10 -0
- data/lib/tinderfridge/devices/bricklet_barometer_v2/bricklet_barometer_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_can_v2/bricklet_can_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_co2_v2/bricklet_co2_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_color_v2/bricklet_color_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_color_v2/bricklet_color_v2.rb +31 -0
- data/lib/tinderfridge/devices/bricklet_compass/bricklet_compass.json +10 -0
- data/lib/tinderfridge/devices/bricklet_dc_v2/bricklet_dc_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_distance_us_v2/bricklet_distance_us_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_dmx/bricklet_dmx.json +10 -0
- data/lib/tinderfridge/devices/bricklet_dmx/bricklet_dmx.rb +18 -0
- data/lib/tinderfridge/devices/bricklet_e_paper_296x128/bricklet_e_paper_296x128.json +10 -0
- data/lib/tinderfridge/devices/bricklet_energy_monitor/bricklet_energy_monitor.json +10 -0
- data/lib/tinderfridge/devices/bricklet_gps_v2/bricklet_gps_v2.json +10 -0
- data/lib/tinderfridge/devices/{bricklet_gps_v2.rb → bricklet_gps_v2/bricklet_gps_v2.rb} +0 -0
- data/lib/tinderfridge/devices/bricklet_hall_effect_v2/bricklet_hall_effect_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_humidity_v2/bricklet_humidity_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_imu_v3/bricklet_imu_v3.json +10 -0
- data/lib/tinderfridge/devices/bricklet_industrial_counter/bricklet_industrial_counter.json +11 -0
- data/lib/tinderfridge/devices/bricklet_industrial_digital_in_4_v2/bricklet_industrial_digital_in_4_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_industrial_digital_out_4_v2/bricklet_industrial_digital_out_4_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_industrial_dual_relay/bricklet_industrial_dual_relay.json +10 -0
- data/lib/tinderfridge/devices/bricklet_industrial_dual_relay/bricklet_industrial_dual_relay.rb +20 -0
- data/lib/tinderfridge/devices/bricklet_industrial_ptc/bricklet_industrial_ptc.json +11 -0
- data/lib/tinderfridge/devices/bricklet_industrial_quad_relay_v2/bricklet_industrial_quad_relay_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_isolator/bricklet_isolator.json +10 -0
- data/lib/tinderfridge/devices/bricklet_isolator/bricklet_isolator.rb +17 -0
- data/lib/tinderfridge/devices/bricklet_joystick_v2/bricklet_joystick_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_joystick_v2/bricklet_joystick_v2.rb +15 -0
- data/lib/tinderfridge/devices/bricklet_laser_range_finder_v2/bricklet_laser_range_finder_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_lcd_128x64/bricklet_lcd_128x64.json +10 -0
- data/lib/tinderfridge/devices/{bricklet_lcd_128x64.rb → bricklet_lcd_128x64/bricklet_lcd_128x64.rb} +0 -0
- data/lib/tinderfridge/devices/bricklet_led_strip_v2/bricklet_led_strip_v2.json +10 -0
- data/lib/tinderfridge/devices/{bricklet_led_strip_v2.rb → bricklet_led_strip_v2/bricklet_led_strip_v2.rb} +12 -0
- data/lib/tinderfridge/devices/bricklet_linear_poti_v2/bricklet_linear_poti_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_motion_detector_v2/bricklet_motion_detector_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_motion_detector_v2/bricklet_motion_detector_v2.rb +22 -0
- data/lib/tinderfridge/devices/bricklet_motorized_linear_poti/bricklet_motorized_linear_poti.json +10 -0
- data/lib/tinderfridge/devices/bricklet_motorized_linear_poti/bricklet_motorized_linear_poti.rb +42 -0
- data/lib/tinderfridge/devices/bricklet_multi_touch_v2/bricklet_multi_touch_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_multi_touch_v2/bricklet_multi_touch_v2.rb +16 -0
- data/lib/tinderfridge/devices/bricklet_nfc/bricklet_nfc.json +10 -0
- data/lib/tinderfridge/devices/bricklet_nfc/bricklet_nfc.rb +16 -0
- data/lib/tinderfridge/devices/bricklet_oled_128x64_v2/bricklet_oled_128x64_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_outdoor_weather/bricklet_outdoor_weather.json +10 -0
- data/lib/tinderfridge/devices/{bricklet_outdoor_weather.rb → bricklet_outdoor_weather/bricklet_outdoor_weather.rb} +0 -0
- data/lib/tinderfridge/devices/bricklet_performance_dc/bricklet_performance_dc.json +11 -0
- data/lib/tinderfridge/devices/bricklet_piezo_speaker_v2/bricklet_piezo_speaker_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_real_time_clock_v2/bricklet_real_time_clock_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_remote_switch_v2/bricklet_remote_switch_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_remote_switch_v2/bricklet_remote_switch_v2.rb +15 -0
- data/lib/tinderfridge/devices/bricklet_rgb_led_button/bricklet_rgb_led_button.json +10 -0
- data/lib/tinderfridge/devices/{bricklet_rgb_led_button.rb → bricklet_rgb_led_button/bricklet_rgb_led_button.rb} +9 -0
- data/lib/tinderfridge/devices/bricklet_rgb_led_v2/bricklet_rgb_led_v2.json +10 -0
- data/lib/tinderfridge/devices/{bricklet_rgb_led_v2.rb → bricklet_rgb_led_v2/bricklet_rgb_led_v2.rb} +7 -0
- data/lib/tinderfridge/devices/bricklet_rotary_encoder_v2/bricklet_rotary_encoder_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_rotary_encoder_v2/bricklet_rotary_encoder_v2.rb +20 -0
- data/lib/tinderfridge/devices/bricklet_rotary_poti_v2/bricklet_rotary_poti_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_rs232_v2/bricklet_rs232_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_rs485/bricklet_rs485.json +11 -0
- data/lib/tinderfridge/devices/bricklet_segment_display_4x7_v2/bricklet_segment_display_4x7_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_segment_display_4x7_v2/bricklet_segment_display_4x7_v2.rb +128 -0
- data/lib/tinderfridge/devices/bricklet_servo_v2/bricklet_servo_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_silent_stepper_v2/bricklet_silent_stepper_v2.json +11 -0
- data/lib/tinderfridge/devices/bricklet_sound_pressure_level/bricklet_sound_pressure_level.json +10 -0
- data/lib/tinderfridge/devices/bricklet_temperature_ir_v2/bricklet_temperature_ir_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_temperature_v2/bricklet_temperature_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_thermal_imaging/bricklet_thermal_imaging.json +10 -0
- data/lib/tinderfridge/devices/bricklet_thermocouple_v2/bricklet_thermocouple_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_uv_light_v2/bricklet_uv_light_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_voltage_current_v2/bricklet_voltage_current_v2.json +10 -0
- data/lib/tinderfridge/devices/bricklet_voltage_current_v2/bricklet_voltage_current_v2.rb +18 -0
- data/lib/tinderfridge/devices/bricklet_xmc1400_breakout/bricklet_xmc1400_breakout.json +10 -0
- data/lib/tinderfridge/ip_connection.rb +66 -10
- data/lib/tinderfridge/tinkerforge.rb +3 -0
- data/lib/tinderfridge/version.rb +1 -1
- metadata +98 -17
- data/lib/tinderfridge/devices/bricklet_segment_display_4x7_v2.rb +0 -20
@@ -0,0 +1,18 @@
|
|
1
|
+
module Tinkerforge
|
2
|
+
|
3
|
+
class BrickletDMX
|
4
|
+
|
5
|
+
# Returns the device's state.
|
6
|
+
def state
|
7
|
+
super.merge(
|
8
|
+
'dmx_mode' => get_dmx_mode,
|
9
|
+
'frame_duration' => get_frame_duration,
|
10
|
+
'frame_error_count' => get_frame_error_count,
|
11
|
+
'communication_led_config' => get_communication_led_config,
|
12
|
+
'error_led_config' => get_error_led_config,
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
{
|
2
|
+
"dimensions": [
|
3
|
+
40,
|
4
|
+
40,
|
5
|
+
11
|
6
|
+
],
|
7
|
+
"weight": 8.6,
|
8
|
+
"documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Digital_In_4_V2.html",
|
9
|
+
"versions_identifier": "bricklets:industrial_digital_in_4_v2",
|
10
|
+
"released": "2018-06-07"
|
11
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
{
|
2
|
+
"dimensions": [
|
3
|
+
40,
|
4
|
+
40,
|
5
|
+
14
|
6
|
+
],
|
7
|
+
"weight": 10,
|
8
|
+
"documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Digital_Out_4_V2.html",
|
9
|
+
"versions_identifier": "bricklets:industrial_digital_out_4_v2",
|
10
|
+
"released": "2018-09-27"
|
11
|
+
}
|
data/lib/tinderfridge/devices/bricklet_industrial_dual_relay/bricklet_industrial_dual_relay.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module Tinkerforge
|
2
|
+
|
3
|
+
class BrickletIndustrialDualRelay
|
4
|
+
|
5
|
+
# Returns the device's state.
|
6
|
+
def state
|
7
|
+
super.merge(
|
8
|
+
'relays' => get_value.each_with_index.map do |v,i|
|
9
|
+
{
|
10
|
+
'value' => v,
|
11
|
+
'output' => v ? 'A' : 'B',
|
12
|
+
'monoflop' => ['time', 'time_remaining'].zip( get_monoflop(i)[1,2] ).to_h,
|
13
|
+
}
|
14
|
+
end
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
{
|
2
|
+
"dimensions": [
|
3
|
+
40,
|
4
|
+
40,
|
5
|
+
11
|
6
|
+
],
|
7
|
+
"weight": 9,
|
8
|
+
"documentation_en_url": "https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Industrial_Quad_Relay_V2.html",
|
9
|
+
"versions_identifier": "bricklets:industrial_quad_relay_v2",
|
10
|
+
"released": "2018-06-07"
|
11
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Tinkerforge
|
2
|
+
|
3
|
+
class BrickletIsolator
|
4
|
+
|
5
|
+
# Returns the device's state.
|
6
|
+
def state
|
7
|
+
super.merge(
|
8
|
+
'statistics' => get_statistics,
|
9
|
+
'spitfp_baudrate_config' => get_spitfp_baudrate_config,
|
10
|
+
'spitfp_baudrate' => get_spitfp_baudrate,
|
11
|
+
'isolator_spitfp_error_count' => get_isolator_spitfp_error_count,
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
data/lib/tinderfridge/devices/{bricklet_lcd_128x64.rb → bricklet_lcd_128x64/bricklet_lcd_128x64.rb}
RENAMED
File without changes
|
@@ -20,6 +20,18 @@ module Tinkerforge
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
# Returns the device's state.
|
24
|
+
def state
|
25
|
+
super.merge(
|
26
|
+
'chip_type' => get_chip_type,
|
27
|
+
'channel_mapping' => get_channel_mapping,
|
28
|
+
'channels' => channels,
|
29
|
+
'frame_duration' => get_frame_duration,
|
30
|
+
'clock_frequency' => get_clock_frequency,
|
31
|
+
'supply_voltage' => get_supply_voltage,
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
23
35
|
private
|
24
36
|
|
25
37
|
def lookup_channel_mapping(selector=nil)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Tinkerforge
|
2
|
+
|
3
|
+
class BrickletMotionDetectorV2
|
4
|
+
|
5
|
+
# Switches off all three blue backlight LEDs.
|
6
|
+
def blackout
|
7
|
+
set_indicator(0, 0, 0)
|
8
|
+
true
|
9
|
+
end
|
10
|
+
|
11
|
+
# Returns the device's state.
|
12
|
+
def state
|
13
|
+
super.merge(
|
14
|
+
'motion_detected' => get_motion_detected == 1,
|
15
|
+
'sensitivity' => get_sensitivity,
|
16
|
+
'indicator' => get_indicator,
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
data/lib/tinderfridge/devices/bricklet_motorized_linear_poti/bricklet_motorized_linear_poti.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
module Tinkerforge
|
2
|
+
|
3
|
+
class BrickletMotorizedLinearPoti
|
4
|
+
|
5
|
+
# Returns the position of the potentiometer (an integer in the range 0..100).
|
6
|
+
def position
|
7
|
+
get_position
|
8
|
+
end
|
9
|
+
|
10
|
+
# Moves the potentiometer to the given position.
|
11
|
+
#
|
12
|
+
# If the potentiometer was locked before, it will be locked at the new position.
|
13
|
+
# The drive mode (speed) will be the same as the last time the position was set.
|
14
|
+
def position=(position)
|
15
|
+
set_motor_position( position, *get_motor_position[1,2] )
|
16
|
+
end
|
17
|
+
|
18
|
+
alias move_to position=
|
19
|
+
|
20
|
+
# Locks the position of the potentiometer. If a position is given, moves to that position first.
|
21
|
+
def lock(position=nil)
|
22
|
+
set_motor_position( position || get_position, get_motor_position[1], true )
|
23
|
+
end
|
24
|
+
|
25
|
+
alias hold lock
|
26
|
+
|
27
|
+
# Releases the potentiometer, so its position can be changed by hand. If a position is given, moves to that position first.
|
28
|
+
def release(position=nil)
|
29
|
+
set_motor_position( position || get_position, get_motor_position[1], false )
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns the device's state.
|
33
|
+
def state
|
34
|
+
super.merge(
|
35
|
+
'position' => get_position,
|
36
|
+
'motor_position' => get_motor_position,
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|