@Override
	public void run() {

		while (true) {
			int currentMotor = MotorX.getSpeed();
			if (currentMotor == 0) {
				currentMotor = 1;
			}
			DelayConstant = 22;
			lightValue = ls.getLightValue();
			Delay.msDelay((int) DelayConstant);
			a = ls.getLightValue();
			Delay.msDelay((int) DelayConstant);
			b = ls.getLightValue();
			Delay.msDelay((int) DelayConstant);
			c = ls.getLightValue();
			Delay.msDelay((int) DelayConstant);
			d = ls.getLightValue();

			delta1 = lightValue - a;
			delta2 = lightValue - b;
			delta3 = lightValue - c;
			delta4 = lightValue - d;

			// beeps when sensor detects line,
			if (delta1 < 2 && (delta2 > 2) || (delta3 > 2) || (delta4 > 2)) {


				onLine = true;
				
			} else {
				onLine = false;
			}
			Delay.msDelay((int) DelayConstant);
		}
	}