Class: Denko::Motor::L298
Constant Summary
Behaviors::Lifecycle::CALLBACK_METHODS
Instance Attribute Summary collapse
#pin, #pins, #proxies
#board, #params
#state
Instance Method Summary
collapse
included
#convert_pins, #proxy_pin, #proxy_states, #require_pin, #require_pins
#initialize, #micro_delay
#update_state
Instance Attribute Details
#speed ⇒ Object
Returns the value of attribute speed.
7
8
9
|
# File 'lib/denko/motor/l298.rb', line 7
def speed
@speed
end
|
Instance Method Details
#brake ⇒ Object
43
44
45
46
47
|
# File 'lib/denko/motor/l298.rb', line 43
def brake
direction1.high
direction2.high
self.speed = 100
end
|
#forward(value = nil) ⇒ Object
24
25
26
27
28
|
# File 'lib/denko/motor/l298.rb', line 24
def forward(value=nil)
direction1.high
direction2.low
self.speed = value if value
end
|
#idle ⇒ Object
Also known as:
off
36
37
38
39
40
|
# File 'lib/denko/motor/l298.rb', line 36
def idle
direction1.low
direction2.low
self.speed = 0
end
|
#initialize_pins(options = {}) ⇒ Object
#reverse(value = nil) ⇒ Object
30
31
32
33
34
|
# File 'lib/denko/motor/l298.rb', line 30
def reverse(value=nil)
direction1.low
direction2.high
self.speed = value if value
end
|