To create a Switch object, the syntax is the following :
mySwitchObject = new Switch(myPort);
where myPort can be 1, 2, 3 or 4.
In Tribot.ini the switch is used as a bumper plugged on the port 4 so the instancing is :
bumper = new Switch(4);
UltraSonicSensor objects are created the same way:
myUSSObject = new UltraSonicSensor(myPort);
myPort can be 1, 2, 3 or 4.
In TriBot.ini an ultrasonic sensor is connected on port 2:
sonar = new UltraSonicSensor(2);
The SoundSensor object has an additional parameter:
mySoundObject = new SoundSensor(myPort, myMode);
myPort can be 1, 2, 3 or 4.
myMode sets the mode of the sensor. It can
be "DB" or "DBA", meaning
"decibel" or "decibel adjusted" (the last one records sounds in
the frequency range 200-14000Hz).
In TriBot.ini, the sound sensor is on port 1
using decibel adjusted:
decibel = new SoundSensor(1,"DBA");
LightSensor also has two parameters :
myLightObject = new LightSensor(myPort, myMode);
myPort can be 1, 2, 3 or
4. myMode sets the sensor mode and it can
be "Ambiant" (so the sensor measures the
ambiant light), "Reflector" (the sensor lights
on its led and measures the reflected light)
and "Normal" (the sensor returns its raw
value).
In TriBot.ini, the light sensor is in reflector
mode on port 1 :
light = new LightSensor(3,"Reflector");