Class: Phidgets::MotorControl::MotorControlDigitalInputs
- Inherits:
- 
      Object
      
        - Object
- Phidgets::MotorControl::MotorControlDigitalInputs
 
- Defined in:
- lib/phidgets-ffi/motor_control.rb
Overview
This class represents a digital input for a PhidgetMotorControl. All the properties of an digital input are stored and modified in this class.
Constant Summary collapse
- Klass =
- Phidgets::FFI::CPhidgetMotorControl 
Instance Method Summary collapse
- 
  
    
      #index  ⇒ Integer 
    
    
  
  
  
  
  
  
  
  
  
    Returns index of the digital input, or raises an error. 
- 
  
    
      #inspect  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Displays data for the digital input. 
- 
  
    
      #off  ⇒ Boolean 
    
    
      (also: #off?)
    
  
  
  
  
  
  
  
  
  
    Returns true if the state is off. 
- 
  
    
      #on  ⇒ Boolean 
    
    
      (also: #on?)
    
  
  
  
  
  
  
  
  
  
    Returns true if the state is true. 
- 
  
    
      #state  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Returns state of the digital input, or raises an error. 
Instance Method Details
#index ⇒ Integer
Returns index of the digital input, or raises an error.
| 377 378 379 | # File 'lib/phidgets-ffi/motor_control.rb', line 377 def index @index end | 
#inspect ⇒ Object
Displays data for the digital input
| 372 373 374 | # File 'lib/phidgets-ffi/motor_control.rb', line 372 def inspect "#<#{self.class} @index=#{index}, @state=#{state}>" end | 
#off ⇒ Boolean Also known as: off?
Returns true if the state is off.
| 395 396 397 | # File 'lib/phidgets-ffi/motor_control.rb', line 395 def off !on end | 
#on ⇒ Boolean Also known as: on?
Returns true if the state is true.
| 389 390 391 | # File 'lib/phidgets-ffi/motor_control.rb', line 389 def on state == true end | 
#state ⇒ Boolean
Returns state of the digital input, or raises an error.
| 382 383 384 385 386 | # File 'lib/phidgets-ffi/motor_control.rb', line 382 def state ptr = ::FFI::MemoryPointer.new(:int) Klass.getInputState(@handle, @index, ptr) (ptr.get_int(0) == 0) ? false : true end |