Class Sensor
In: lib/sensors/sensor.rb
Parent: Brick

Controls and reads an NXT sensor.




Public Class methods

TODO: internal sensor numbering is 0x00 to 0x03, but sensor ports on the brick are marked 1 to 4…

      need to come up with some way to make sure there isn't confusion (or maybe it's okay, since
      if the user probably never uses the Sensor classes directly, only interacting via the NXT

Public Instance methods

Continuously evalutes the given block until it returns at least the given value (that is, until the block returns a value equal or greater than the given argument). If no value is specified, the block will be continuously evaluated until it returns true. Optionally, a comparison operator can be specified as the second parameter, otherwise >= is used (or == if expected value is Boolean).

Simple example:

  ts =
  ts.wait_for_event { ts.is_pressed? }

Example with an expected value:

  ls =
  ls.wait_for_event(0.55) do