Class: Capoblo::ArduinoSensors
- Inherits:
-
Object
- Object
- Capoblo::ArduinoSensors
- Defined in:
- lib/capoblo/arduino_sensors.rb
Constant Summary collapse
- ULTRASONIC_TRIGGER =
11
- ULTRASONIC_ECHO =
12
- AVOIDANCE_SENSOR_PIN =
2
Instance Attribute Summary collapse
-
#arduino ⇒ Object
Returns the value of attribute arduino.
-
#front_distance ⇒ Object
Returns the value of attribute front_distance.
-
#rear_distance ⇒ Object
Returns the value of attribute rear_distance.
Instance Method Summary collapse
-
#initialize ⇒ ArduinoSensors
constructor
A new instance of ArduinoSensors.
Constructor Details
#initialize ⇒ ArduinoSensors
Returns a new instance of ArduinoSensors.
10 11 12 13 14 15 16 17 |
# File 'lib/capoblo/arduino_sensors.rb', line 10 def initialize super self.arduino = ARDUINO_ONE self.arduino.pin_mode ULTRASONIC_TRIGGER, ArduinoFirmata::OUTPUT self.arduino.pin_mode ULTRASONIC_ECHO, ArduinoFirmata::INPUT self.arduino.pin_mode AVOIDANCE_SENSOR_PIN, ArduinoFirmata::INPUT end |
Instance Attribute Details
#arduino ⇒ Object
Returns the value of attribute arduino.
3 4 5 |
# File 'lib/capoblo/arduino_sensors.rb', line 3 def arduino @arduino end |
#front_distance ⇒ Object
Returns the value of attribute front_distance.
3 4 5 |
# File 'lib/capoblo/arduino_sensors.rb', line 3 def front_distance @front_distance end |
#rear_distance ⇒ Object
Returns the value of attribute rear_distance.
3 4 5 |
# File 'lib/capoblo/arduino_sensors.rb', line 3 def rear_distance @rear_distance end |