Class: Denko::Motor::L298
Instance Attribute Summary collapse
#pin, #pins, #proxies
#board
Instance Method Summary
collapse
#before_initialize, #convert_pins, #proxy_pin, #proxy_states, #require_pin, #require_pins
#initialize, #micro_delay
#initialize, #state
Instance Attribute Details
#speed ⇒ Object
Returns the value of attribute speed.
6
7
8
|
# File 'lib/denko/motor/l298.rb', line 6
def speed
@speed
end
|
Instance Method Details
#after_initialize(options = {}) ⇒ Object
14
15
16
|
# File 'lib/denko/motor/l298.rb', line 14
def after_initialize(options={})
off
end
|
#brake ⇒ Object
42
43
44
45
46
|
# File 'lib/denko/motor/l298.rb', line 42
def brake
direction1.high
direction2.high
self.speed = board.pwm_high
end
|
#forward(value = nil) ⇒ Object
23
24
25
26
27
|
# File 'lib/denko/motor/l298.rb', line 23
def forward(value=nil)
direction1.high
direction2.low
self.speed = value if value
end
|
#idle ⇒ Object
Also known as:
off
35
36
37
38
39
|
# File 'lib/denko/motor/l298.rb', line 35
def idle
direction1.low
direction2.low
self.speed = 0
end
|
#initialize_pins(options = {}) ⇒ Object
#reverse(value = nil) ⇒ Object
29
30
31
32
33
|
# File 'lib/denko/motor/l298.rb', line 29
def reverse(value=nil)
direction1.low
direction2.high
self.speed = value if value
end
|