examples/bobbee.rb in lignite-0.2.0 vs examples/bobbee.rb in lignite-0.3.0
- old
+ new
@@ -1,18 +1,18 @@
#!/usr/bin/ruby
-# coding: utf-8
+
# https://www.lego.com/mindstorms/build-a-robot/bobb3e
# A Bobcat® like two-tracked forklift
require "lignite"
class Bobbee
# @return [Lignite::Motors]
- attr :drive
+ attr_reader :drive
# @return [Lignite::Motors]
- attr :lift
- attr :dc
+ attr_reader :lift
+ attr_reader :dc
def initialize(drive: Lignite::PORT_B | Lignite::PORT_C,
lift: Lignite::PORT_A,
dc: Lignite::DirectCommands.new)
layer = 0
@@ -47,26 +47,26 @@
lift.step_power(30, 10, LIFT_FULL - 20, 10)
lift.ready if wait
end
def third_raise(wait: true)
- lift.step_power(30, 10, LIFT_FULL/3 - 20, 10)
+ lift.step_power(30, 10, LIFT_FULL / 3 - 20, 10)
lift.ready if wait
beep
sleep 3
end
def lower(wait: true)
- lift.step_power(-1, 10, LIFT_FULL - 20, 10) #, Lignite::COAST)
+ lift.step_power(-1, 10, LIFT_FULL - 20, 10) # , Lignite::COAST)
lift.ready if wait
beep
sleep 3
end
def third_lower(wait: true)
- lift.step_power(-1, 10, LIFT_FULL/3 - 20, 10)
+ lift.step_power(-1, 10, LIFT_FULL / 3 - 20, 10)
lift.ready if wait
end
def beep(ms = 300)
dc.sound_tone(20, 1760, ms)