Esempio n. 1
0
void Calibrate()
{
  T("enter Calibrate");
  LLinit(LINELEADER);
  nxtScrollText("Place over white");
  PressBumperToContinue();
  wait1Msec(500);
  LLcalWhite(LINELEADER);

  nxtScrollText("");
  nxtScrollText("Place over line");
  nxtScrollText("(Black)");
  PressBumperToContinue();
  wait1Msec(500);
  LLcalBlack(LINELEADER);

  // compass calibration
  nxtScrollText("");
  nxtScrollText("compass calibrate");
  PressBumperToContinue();
  wait1Msec(500);
  motor[LEFT] = 30;
  motor[RIGHT] = -30;
  wait1Msec(500);
  HTMCstartCal(COMPASS);
  wait1Msec(5000);
  HTMCstopCal(COMPASS);
  motor[LEFT] = 0;
  motor[RIGHT] = 0;

  PlaySound(soundFastUpwardTones);
  T("leave Calibrate");
  wait1Msec(2000);
}
// Start the calibration and complain loudly if something goes wrong
void startCalibration() {
  if (!HTMCstartCal(HTCOMPASS)) {
    eraseDisplay();
    nxtDisplayTextLine(1, "ERROR: Couldn't");
    nxtDisplayTextLine(2, "calibrate sensor.");
    nxtDisplayTextLine(4, "Check connection");
    nxtDisplayTextLine(5, "and try again.");
    PlaySound(soundException);
    while(bSoundActive) EndTimeSlice();
    wait1Msec(5000);
    StopAllTasks();
  }
}
Esempio n. 3
0
task main()
{
    done = false;

	eraseDisplay();

    nMotorEncoder[driveRight] = 0;
    nMotorEncoder[driveLeft] = 0;

	HTMCstartCal(HTMC);
	StartTask(rotate);

    while (!done) {
        nxtDisplayTextLine(2, "Right: %d", nMotorEncoder[driveRight]);
        nxtDisplayTextLine(3, "Left:  %d", nMotorEncoder[driveLeft]);
    }
	HTMCstopCal(HTMC);

    while (true) {}
}