#pragma config(Sensor, S2, HTMSSUMO, sensorLightActive)
#pragma config(Motor, motorA, RIGHT, tmotorNormal, PIDControl, encoder)
#pragma config(Motor, motorB, LEFT, tmotorNormal, PIDControl, encoder)
#include "drivers/mindsensors-sumoeyes.h"
task main() {
bool shortrange = true;
tObstacleZone zone = 0;
nNxtButtonTask = -2;
eraseDisplay();
nxtDisplayCenteredTextLine(0, "Mindsensors");
nxtDisplayCenteredBigTextLine(1, "SUMO Eyes");
nxtDisplayCenteredTextLine(3, "Test 1");
nxtDisplayCenteredTextLine(5, "Press enter to");
nxtDisplayCenteredTextLine(6, "switch between");
nxtDisplayCenteredTextLine(7, "ranges");
wait1Msec(2000);
eraseDisplay();
MSSUMOsetShortRange(HTMSSUMO);
while(true) {
if (time1[T1] > 1000) {
if (shortrange == false) {
MSSUMOsetShortRange(HTMSSUMO);
nxtDisplayClearTextLine(1);
nxtDisplayTextLine(1, "Short range");
shortrange = true;
} else {
MSSUMOsetLongRange(HTMSSUMO);
nxtDisplayClearTextLine(1);
nxtDisplayTextLine(1, "Long range");
shortrange = false;
}
PlaySound(soundBeepBeep);
while(bSoundActive)
time1[T1] = 0;
}
while(nNxtButtonPressed != kEnterButton) {
zone = MSSUMOreadZone(HTMSSUMO);
switch (zone) {
case MSSUMO_FRONT: nxtDisplayCenteredBigTextLine(4, "FRONT"); break;
case MSSUMO_LEFT: nxtDisplayCenteredBigTextLine(4, "LEFT"); break;
case MSSUMO_RIGHT: nxtDisplayCenteredBigTextLine(4, "RIGHT"); break;
case MSSUMO_NONE: nxtDisplayCenteredBigTextLine(4, "NONE"); break;
}
wait1Msec(50);
}
}
}