Class: Rumba::Sensor::BumpsAndWheelDrops

Inherits:
Object
  • Object
show all
Defined in:
lib/rumba/sensors.rb

Class Method Summary collapse

Class Method Details

.convert(v) ⇒ Object



79
80
81
82
83
84
85
86
# File 'lib/rumba/sensors.rb', line 79

def self.convert(v)
  h = {}
  h[:bump_right]       = v & 0b1 > 0
  h[:bump_left]        = v & 0b10 > 0
  h[:wheel_drop_right] = v & 0b100 > 0
  h[:wheel_drop_left]  = v & 0b1000 > 0
  h
end