//=============================================================================
// Main Task
TASK(TaskMain)
{
// establish blutooth connection with a PC to use a PC HID GamePad controller
BTConnection btConnection(bt, lcd, nxt);
(void)btConnection.connect(BT_PASS_KEY);
for (U32 i = 5; i <= Lcd::MAX_CURSOR_Y; i++) lcd.clearRow(i);
lcd.cursor(0,5);
lcd.putf("snsns", "TOUCH:START/STOP", "STAND IT UP AND", "WAIT FOR A BEEP.");
lcd.disp();
SetRelAlarm(Alarm4msec, 1, 4); // Set 4msec periodical Alarm for the drive event
while(1)
{
sonarDriver.checkObstacles(sonar);
clock.wait(40); // 40msec wait
}
}