UltraSonicSensor

UltraSonicSensor describes a sonar sensor. A UltraSonicSensor instance contains the following attributes:

Table A.2. UltraSonic Sensor's attributes:

NameDescription
valDistance in cm (from 0 to 255).
portThe port where the servo is plugged. It can be 1, 2, 3 or 4. You can change the value while the server is running. Beware, if you change the port, that will free the old port (so you will be able to create another device on it) and will busy the new one (so you won't be able to create another device on it).
init(port_)

The UObject constructor.

port_ is a port name. (See previous attribute port).

Example:

sonar = UltraSonicSensor.new(1);