phidgets 0.1.3 → 1.0.0
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 +4 -4
- data/History.txt +3 -0
- data/README.rdoc +32 -43
- data/Rakefile +4 -2
- data/bin/phidget +18 -72
- data/ext/phidgets/extconf.rb +5 -8
- data/ext/phidgets/phidgets.c +708 -173
- data/ext/phidgets/phidgets.h +54 -35
- data/ext/phidgets/phidgets_accelerometer.c +193 -109
- data/ext/phidgets/phidgets_bldc_motor.c +529 -0
- data/ext/phidgets/phidgets_capacitive_touch.c +302 -0
- data/ext/phidgets/phidgets_common.c +570 -315
- data/ext/phidgets/phidgets_current_input.c +229 -0
- data/ext/phidgets/phidgets_dc_motor.c +562 -0
- data/ext/phidgets/phidgets_dictionary.c +154 -213
- data/ext/phidgets/phidgets_digital_input.c +127 -0
- data/ext/phidgets/phidgets_digital_output.c +288 -0
- data/ext/phidgets/phidgets_distance_sensor.c +295 -0
- data/ext/phidgets/phidgets_encoder.c +211 -192
- data/ext/phidgets/phidgets_frequency_counter.c +310 -177
- data/ext/phidgets/phidgets_gps.c +226 -164
- data/ext/phidgets/phidgets_gyroscope.c +195 -0
- data/ext/phidgets/phidgets_hub.c +39 -0
- data/ext/phidgets/phidgets_humidity_sensor.c +200 -0
- data/ext/phidgets/phidgets_ir.c +211 -171
- data/ext/phidgets/phidgets_lcd.c +512 -0
- data/ext/phidgets/phidgets_light_sensor.c +200 -0
- data/ext/phidgets/phidgets_log.c +263 -0
- data/ext/phidgets/phidgets_magnetometer.c +279 -0
- data/ext/phidgets/phidgets_manager.c +86 -297
- data/ext/phidgets/phidgets_motor_position_controller.c +787 -0
- data/ext/phidgets/phidgets_phsensor.c +200 -152
- data/ext/phidgets/phidgets_power_guard.c +144 -0
- data/ext/phidgets/phidgets_pressure_sensor.c +200 -0
- data/ext/phidgets/phidgets_rc_servo.c +672 -0
- data/ext/phidgets/phidgets_resistance_input.c +227 -0
- data/ext/phidgets/phidgets_rfid.c +107 -221
- data/ext/phidgets/phidgets_sound_sensor.c +284 -0
- data/ext/phidgets/phidgets_spatial.c +124 -318
- data/ext/phidgets/phidgets_stepper.c +457 -430
- data/ext/phidgets/phidgets_temp_sensor.c +223 -228
- data/ext/phidgets/phidgets_voltage_input.c +428 -0
- data/ext/phidgets/phidgets_voltage_output.c +167 -0
- data/ext/phidgets/phidgets_voltage_ratio_input.c +435 -0
- data/lib/phidgets.rb +21 -14
- data/lib/phidgets/accelerometer.rb +11 -15
- data/lib/phidgets/bldc_motor.rb +45 -0
- data/lib/phidgets/capacitive_touch.rb +33 -0
- data/lib/phidgets/common.rb +40 -69
- data/lib/phidgets/current_input.rb +21 -0
- data/lib/phidgets/dc_motor.rb +45 -0
- data/lib/phidgets/dictionary.rb +30 -39
- data/lib/phidgets/digital_input.rb +21 -0
- data/lib/phidgets/digital_output.rb +56 -0
- data/lib/phidgets/distance_sensor.rb +33 -0
- data/lib/phidgets/encoder.rb +1 -29
- data/lib/phidgets/frequency_counter.rb +23 -14
- data/lib/phidgets/gps.rb +34 -26
- data/lib/phidgets/gyroscope.rb +21 -0
- data/lib/phidgets/humidity_sensor.rb +21 -0
- data/lib/phidgets/ir.rb +34 -39
- data/lib/phidgets/light_sensor.rb +21 -0
- data/lib/phidgets/magnetometer.rb +21 -0
- data/lib/phidgets/manager.rb +18 -66
- data/lib/phidgets/motor_position_controller.rb +45 -0
- data/lib/phidgets/ph_sensor.rb +2 -6
- data/lib/phidgets/pressure_sensor.rb +21 -0
- data/lib/phidgets/rc_servo.rb +58 -0
- data/lib/phidgets/resistance_input.rb +21 -0
- data/lib/phidgets/rfid.rb +22 -38
- data/lib/phidgets/sound_sensor.rb +21 -0
- data/lib/phidgets/spatial.rb +11 -15
- data/lib/phidgets/stepper.rb +48 -50
- data/lib/phidgets/temperature_sensor.rb +11 -15
- data/lib/phidgets/version.rb +5 -0
- data/lib/phidgets/voltage_input.rb +34 -0
- data/lib/phidgets/voltage_output.rb +23 -0
- data/lib/phidgets/voltage_ratio_input.rb +34 -0
- data/phidgets.gemspec +3 -22
- data/test/test_accelerometer.rb +42 -23
- data/test/test_bldc_motor.rb +134 -0
- data/test/test_capacitive_touch.rb +82 -0
- data/test/test_common.rb +125 -108
- data/test/test_current_input.rb +62 -0
- data/test/test_dc_motor.rb +146 -0
- data/test/test_dictionary.rb +22 -54
- data/test/test_digital_input.rb +30 -0
- data/test/test_digital_output.rb +70 -0
- data/test/test_distance_sensor.rb +76 -0
- data/test/test_encoder.rb +45 -38
- data/test/test_frequency_counter.rb +71 -36
- data/test/test_gps.rb +29 -38
- data/test/test_gyroscope.rb +54 -0
- data/test/test_helper.rb +0 -1
- data/test/test_hub.rb +14 -0
- data/test/test_humidity_sensor.rb +58 -0
- data/test/test_ir.rb +34 -34
- data/test/test_lcd.rb +146 -0
- data/test/test_light_sensor.rb +58 -0
- data/test/test_magnetometer.rb +78 -0
- data/test/test_manager.rb +10 -79
- data/test/test_motor_control.rb +146 -108
- data/test/test_phidgets.rb +2 -14
- data/test/test_phsensor.rb +46 -34
- data/test/test_power_guard.rb +42 -0
- data/test/test_pressure_sensor.rb +58 -0
- data/test/test_rc_servo.rb +174 -0
- data/test/test_resistance_input.rb +66 -0
- data/test/test_rfid.rb +15 -54
- data/test/test_sound_sensor.rb +78 -0
- data/test/test_spatial.rb +19 -85
- data/test/test_stepper.rb +89 -98
- data/test/test_temp_sensor.rb +42 -47
- data/test/test_voltage_input.rb +102 -0
- data/test/test_voltage_output.rb +46 -0
- data/test/test_voltage_ratio_input.rb +102 -0
- metadata +72 -89
- data/ext/phidgets/phidgets_advanced_servo.c +0 -567
- data/ext/phidgets/phidgets_analog.c +0 -139
- data/ext/phidgets/phidgets_bridge.c +0 -263
- data/ext/phidgets/phidgets_interface_kit.c +0 -340
- data/ext/phidgets/phidgets_led.c +0 -178
- data/ext/phidgets/phidgets_motor_control.c +0 -642
- data/ext/phidgets/phidgets_servo.c +0 -276
- data/ext/phidgets/phidgets_text_lcd.c +0 -381
- data/ext/phidgets/phidgets_text_led.c +0 -107
- data/ext/phidgets/phidgets_weight_sensor.c +0 -113
- data/lib/phidgets/advanced_servo.rb +0 -49
- data/lib/phidgets/analog.rb +0 -8
- data/lib/phidgets/bridge.rb +0 -25
- data/lib/phidgets/interfacekit.rb +0 -49
- data/lib/phidgets/led.rb +0 -8
- data/lib/phidgets/motor_control.rb +0 -110
- data/lib/phidgets/servo.rb +0 -23
- data/lib/phidgets/text_lcd.rb +0 -8
- data/lib/phidgets/text_led.rb +0 -8
- data/lib/phidgets/weight_sensor.rb +0 -25
- data/test/test_advanced_servo.rb +0 -152
- data/test/test_analog.rb +0 -45
- data/test/test_bridge.rb +0 -77
- data/test/test_interfacekit.rb +0 -97
- data/test/test_led.rb +0 -55
- data/test/test_servo.rb +0 -67
- data/test/test_text_lcd.rb +0 -115
- data/test/test_text_led.rb +0 -35
- data/test/test_weight_sensor.rb +0 -32
data/test/test_rfid.rb
CHANGED
@@ -2,75 +2,36 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
2
2
|
|
3
3
|
class TestPhidgetsRFID < Test::Unit::TestCase
|
4
4
|
|
5
|
-
def
|
6
|
-
|
5
|
+
def setup
|
6
|
+
@phidget = Phidgets::RFID.new
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
|
11
|
-
assert_raise(Phidgets::Error::NotAttached) {rfid.output_count}
|
9
|
+
def test_get_antenna_enabled
|
10
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.antenna_enabled?}
|
12
11
|
end
|
13
12
|
|
14
|
-
def
|
15
|
-
|
16
|
-
assert_raise(Phidgets::Error::NotAttached) {rfid.output_state 1}
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_set_output_state
|
20
|
-
rfid = Phidgets::RFID.new
|
21
|
-
assert_raise(Phidgets::Error::NotAttached) {rfid.set_output_state 1, true}
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_get_antenna_on
|
25
|
-
rfid = Phidgets::RFID.new
|
26
|
-
assert_raise(Phidgets::Error::NotAttached) {rfid.antenna_on?}
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_set_antenna_on
|
30
|
-
rfid = Phidgets::RFID.new
|
31
|
-
assert_raise(Phidgets::Error::NotAttached) {rfid.antenna_on = true}
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_get_led_on
|
35
|
-
rfid = Phidgets::RFID.new
|
36
|
-
assert_raise(Phidgets::Error::NotAttached) {rfid.led_on?}
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_set_led_on
|
40
|
-
rfid = Phidgets::RFID.new
|
41
|
-
assert_raise(Phidgets::Error::NotAttached) {rfid.led_on = true}
|
13
|
+
def test_set_antenna_enabled
|
14
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.antenna_enabled = true}
|
42
15
|
end
|
43
16
|
|
44
17
|
def test_get_last_tag
|
45
|
-
|
46
|
-
assert_raise(Phidgets::Error::NotAttached) {rfid.last_tag}
|
18
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.last_tag}
|
47
19
|
end
|
48
20
|
|
49
|
-
def
|
50
|
-
|
51
|
-
assert_raise(Phidgets::Error::NotAttached) {rfid.tag_status}
|
21
|
+
def test_get_tag_present
|
22
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.tag_present?}
|
52
23
|
end
|
53
24
|
|
54
25
|
def test_write
|
55
|
-
|
56
|
-
assert_raise(Phidgets::Error::NotAttached) {rfid.write 'new_tag', Phidgets::RFID::PROTOCOL_EM4100, false}
|
26
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.write 'new_tag', Phidgets::RFID::PROTOCOL_EM4100, false}
|
57
27
|
end
|
58
28
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
assert_nothing_raised {rfid.on_tag {puts 'hello'}}
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_set_on_tag_lost
|
66
|
-
rfid = Phidgets::RFID.new
|
67
|
-
assert_nothing_raised {rfid.on_tag_lost {puts 'goodbye'}}
|
68
|
-
end
|
29
|
+
def test_set_on_tag
|
30
|
+
assert_nothing_raised {@phidget.on_tag {puts 'tag_found'}}
|
31
|
+
end
|
69
32
|
|
70
|
-
|
71
|
-
|
72
|
-
assert_nothing_raised {rfid.on_output_change {puts 'hello'}}
|
73
|
-
end
|
33
|
+
def test_set_on_tag_lost
|
34
|
+
assert_nothing_raised {@phidget.on_tag_lost {puts 'tag_lost'}}
|
74
35
|
end
|
75
36
|
|
76
37
|
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestPhidgetsSoundSensor < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@phidget = Phidgets::SoundSensor.new
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_get_data_interval
|
10
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.data_interval}
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_set_data_interval
|
14
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.data_interval = 2}
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_get_min_data_interval
|
18
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.min_data_interval}
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_get_max_data_interval
|
22
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.max_data_interval}
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_get_db
|
26
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.db}
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_get_max_db
|
30
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.max_db}
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_get_dba
|
34
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.dba}
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_get_dbc
|
38
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.dbc}
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_get_noise_floor
|
42
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.noise_floor}
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_get_octaves
|
46
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.octaves}
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_get_spl_change_trigger
|
50
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.spl_change_trigger}
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_set_spl_change_trigger
|
54
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.spl_change_trigger = 2.5}
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_get_min_spl_change_trigger
|
58
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.min_spl_change_trigger}
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_get_max_spl_change_trigger
|
62
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.max_spl_change_trigger}
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_get_spl_range
|
66
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.spl_range}
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_set_spl_range
|
70
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.spl_range = Phidgets::SoundSensor::SPL_RANGE_102dB}
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_set_on_spl_change
|
74
|
+
assert_nothing_raised {@phidget.on_spl_change {puts 'spl_changed'}}
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
data/test/test_spatial.rb
CHANGED
@@ -2,110 +2,44 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
2
2
|
|
3
3
|
class TestPhidgetsSpatial < Test::Unit::TestCase
|
4
4
|
|
5
|
-
def
|
6
|
-
|
5
|
+
def setup
|
6
|
+
@phidget = Phidgets::Spatial.new
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
|
11
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.acceleration_axis_count}
|
9
|
+
def test_get_data_interval
|
10
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.data_interval}
|
12
11
|
end
|
13
12
|
|
14
|
-
def
|
15
|
-
|
16
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.gyro_axis_count}
|
13
|
+
def test_set_data_interval
|
14
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.data_interval = 2}
|
17
15
|
end
|
18
16
|
|
19
|
-
def
|
20
|
-
|
21
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.compass_axis_count}
|
17
|
+
def test_get_min_data_interval
|
18
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.min_data_interval}
|
22
19
|
end
|
23
20
|
|
24
|
-
def
|
25
|
-
|
26
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.acceleration 1}
|
21
|
+
def test_get_max_data_interval
|
22
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.max_data_interval}
|
27
23
|
end
|
28
24
|
|
29
|
-
def
|
30
|
-
|
31
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.acceleration_min 1}
|
25
|
+
def test_set_magnetometer_correction_parameters
|
26
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.set_magnetometer_correction_parameters( 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3 )}
|
32
27
|
end
|
33
28
|
|
34
|
-
def
|
35
|
-
|
36
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.acceleration_max 1}
|
29
|
+
def test_reset_magnetometer_correction_parameters
|
30
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.reset_magnetometer_correction_parameters}
|
37
31
|
end
|
38
32
|
|
39
|
-
def
|
40
|
-
|
41
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.angular_rate 1}
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_get_angular_rate_min
|
45
|
-
spatial = Phidgets::Spatial.new
|
46
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.angular_rate_min 1}
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_get_angular_rate_max
|
50
|
-
spatial = Phidgets::Spatial.new
|
51
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.angular_rate_max 1}
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_get_magnetic_field
|
55
|
-
spatial = Phidgets::Spatial.new
|
56
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.magnetic_field 1}
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_get_magnetic_field_min
|
60
|
-
spatial = Phidgets::Spatial.new
|
61
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.magnetic_field_min 1}
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_get_magnetic_field_max
|
65
|
-
spatial = Phidgets::Spatial.new
|
66
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.magnetic_field_max 1}
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_get_data_rate
|
70
|
-
spatial = Phidgets::Spatial.new
|
71
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.data_rate}
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_get_data_rate_min
|
75
|
-
spatial = Phidgets::Spatial.new
|
76
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.data_rate_min}
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_get_data_rate_max
|
80
|
-
spatial = Phidgets::Spatial.new
|
81
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.data_rate_max}
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_set_data_rate
|
85
|
-
spatial = Phidgets::Spatial.new
|
86
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.data_rate = 1000}
|
33
|
+
def test_save_magnetometer_correction_parameters
|
34
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.save_magnetometer_correction_parameters}
|
87
35
|
end
|
88
36
|
|
89
37
|
def test_zero_gyro
|
90
|
-
|
91
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.zero_gyro}
|
92
|
-
end
|
93
|
-
|
94
|
-
def test_set_compass_correction_parameters
|
95
|
-
spatial = Phidgets::Spatial.new
|
96
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.set_compass_correction_parameters 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3}
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_reset_compass_correction_parameters
|
100
|
-
spatial = Phidgets::Spatial.new
|
101
|
-
assert_raise(Phidgets::Error::NotAttached) {spatial.reset_compass_correction_parameters}
|
38
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.zero_gyro}
|
102
39
|
end
|
103
40
|
|
104
|
-
|
105
|
-
|
106
|
-
spatial = Phidgets::Spatial.new
|
107
|
-
assert_nothing_raised {spatial.on_spatial_data {puts 'hello'}}
|
108
|
-
end
|
41
|
+
def test_set_on_spatial_data
|
42
|
+
assert_nothing_raised {@phidget.on_spatial_data {puts 'spatial_data_received'}}
|
109
43
|
end
|
110
44
|
|
111
45
|
end
|
data/test/test_stepper.rb
CHANGED
@@ -2,161 +2,152 @@ require File.dirname(__FILE__) + '/test_helper.rb'
|
|
2
2
|
|
3
3
|
class TestPhidgetsStepper < Test::Unit::TestCase
|
4
4
|
|
5
|
-
def
|
6
|
-
|
5
|
+
def setup
|
6
|
+
@phidget = Phidgets::Stepper.new
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
|
11
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.input_count}
|
9
|
+
def test_get_acceleration
|
10
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.acceleration}
|
12
11
|
end
|
13
12
|
|
14
|
-
def
|
15
|
-
|
16
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.input_state 1}
|
13
|
+
def test_set_acceleration
|
14
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.acceleration = 0.14}
|
17
15
|
end
|
18
16
|
|
19
|
-
def
|
20
|
-
|
21
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.motor_count}
|
17
|
+
def test_get_min_acceleration
|
18
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.min_acceleration}
|
22
19
|
end
|
23
20
|
|
24
|
-
def
|
25
|
-
|
26
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.acceleration 1}
|
21
|
+
def test_get_max_acceleration
|
22
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.max_acceleration}
|
27
23
|
end
|
28
24
|
|
29
|
-
def
|
30
|
-
|
31
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.acceleration_min 1}
|
25
|
+
def test_get_control_mode
|
26
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.control_mode}
|
32
27
|
end
|
33
28
|
|
34
|
-
def
|
35
|
-
|
36
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.acceleration_max 1}
|
29
|
+
def test_set_control_mode
|
30
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.control_mode = Phidgets::Stepper::CONTROL_MODE_STEP}
|
37
31
|
end
|
38
32
|
|
39
|
-
def
|
40
|
-
|
41
|
-
# ?? assert_raise(Phidgets::Error::NotAttached) {stepper.set_acceleration 1, 0.14}
|
42
|
-
assert_raise(Phidgets::Error::OutOfBounds) {stepper.set_acceleration 1, 0.14}
|
33
|
+
def test_get_current_limit
|
34
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.current_limit}
|
43
35
|
end
|
44
36
|
|
45
|
-
def
|
46
|
-
|
47
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.velocity_limit 1}
|
37
|
+
def test_set_current_limit
|
38
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.current_limit = 2.5}
|
48
39
|
end
|
49
40
|
|
50
|
-
def
|
51
|
-
|
52
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.set_velocity_limit 1, 2.14}
|
41
|
+
def test_get_min_current_limit
|
42
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.min_current_limit}
|
53
43
|
end
|
54
44
|
|
55
|
-
def
|
56
|
-
|
57
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.velocity 1}
|
45
|
+
def test_get_max_current_limit
|
46
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.max_current_limit}
|
58
47
|
end
|
59
48
|
|
60
|
-
def
|
61
|
-
|
62
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.velocity_min 1}
|
49
|
+
def test_get_data_interval
|
50
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.data_interval}
|
63
51
|
end
|
64
52
|
|
65
|
-
def
|
66
|
-
|
67
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.velocity_max 1}
|
53
|
+
def test_set_data_interval
|
54
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.data_interval = 2}
|
68
55
|
end
|
69
56
|
|
70
|
-
def
|
71
|
-
|
72
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.target_position 1}
|
57
|
+
def test_get_min_data_interval
|
58
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.min_data_interval}
|
73
59
|
end
|
74
60
|
|
75
|
-
def
|
76
|
-
|
77
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.set_target_position 1, 500}
|
61
|
+
def test_get_max_data_interval
|
62
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.max_data_interval}
|
78
63
|
end
|
79
64
|
|
80
|
-
def
|
81
|
-
|
82
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.current_position 1}
|
65
|
+
def test_get_engaged
|
66
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.engaged?}
|
83
67
|
end
|
84
68
|
|
85
|
-
def
|
86
|
-
|
87
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.set_current_position 1, 500}
|
69
|
+
def test_set_engaged
|
70
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.engaged = true}
|
88
71
|
end
|
89
72
|
|
90
|
-
def
|
91
|
-
|
92
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.position_min 1}
|
73
|
+
def test_get_holding_current_limit
|
74
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.holding_current_limit}
|
93
75
|
end
|
94
76
|
|
95
|
-
def
|
96
|
-
|
97
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.position_max 1}
|
77
|
+
def test_set_holding_current_limit
|
78
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.holding_current_limit = 2.5}
|
98
79
|
end
|
99
80
|
|
100
|
-
def
|
101
|
-
|
102
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.current_limit 1}
|
81
|
+
def test_get_is_moving
|
82
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.is_moving?}
|
103
83
|
end
|
104
84
|
|
105
|
-
def
|
106
|
-
|
107
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.set_current_limit 1, 10.7}
|
85
|
+
def test_get_position
|
86
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.position}
|
108
87
|
end
|
109
88
|
|
110
|
-
def
|
111
|
-
|
112
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.current 1}
|
89
|
+
def test_get_min_position
|
90
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.min_position}
|
113
91
|
end
|
114
92
|
|
115
|
-
def
|
116
|
-
|
117
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.current_min 1}
|
93
|
+
def test_get_max_position
|
94
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.max_position}
|
118
95
|
end
|
119
96
|
|
120
|
-
def
|
121
|
-
|
122
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.current_max 1}
|
97
|
+
def test_add_position_offset
|
98
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.add_position_offset(5.2)}
|
123
99
|
end
|
124
100
|
|
125
|
-
def
|
126
|
-
|
127
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.engaged? 1}
|
101
|
+
def test_get_rescale_factor
|
102
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.rescale_factor}
|
128
103
|
end
|
129
104
|
|
130
|
-
def
|
131
|
-
|
132
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.set_engaged 1, true}
|
105
|
+
def test_set_rescale_factor
|
106
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.rescale_factor = 2.5}
|
133
107
|
end
|
134
108
|
|
135
|
-
def
|
136
|
-
|
137
|
-
assert_raise(Phidgets::Error::NotAttached) {stepper.stopped? 1}
|
109
|
+
def test_get_target_position
|
110
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.target_position}
|
138
111
|
end
|
139
112
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
113
|
+
def test_set_target_position
|
114
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.target_position = 2.5}
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_set_target_position_async
|
118
|
+
assert_nothing_raised {@phidget.set_target_position_async(3.3) {puts 'target_position_set'}}
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_get_velocity
|
122
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.velocity}
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_get_velocity_limit
|
126
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.velocity_limit}
|
127
|
+
end
|
145
128
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
end
|
129
|
+
def test_set_velocity_limit
|
130
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.velocity_limit = 2.5}
|
131
|
+
end
|
150
132
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
133
|
+
def test_get_min_velocity_limit
|
134
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.min_velocity_limit}
|
135
|
+
end
|
136
|
+
|
137
|
+
def test_get_max_velocity_limit
|
138
|
+
assert_raise(Phidgets::Error::DeviceNotAttached) {@phidget.max_velocity_limit}
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_set_on_position_change
|
142
|
+
assert_nothing_raised {@phidget.on_position_change {puts 'position_changed'}}
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_set_on_stopped
|
146
|
+
assert_nothing_raised {@phidget.on_stopped {puts 'stopped'}}
|
147
|
+
end
|
155
148
|
|
156
|
-
|
157
|
-
|
158
|
-
assert_nothing_raised {stepper.on_current_change {puts 'hello'}}
|
159
|
-
end
|
149
|
+
def test_set_on_velocity_change
|
150
|
+
assert_nothing_raised {@phidget.on_velocity_change {puts 'velocity_changed'}}
|
160
151
|
end
|
161
152
|
|
162
153
|
end
|