//*!!Sensor,    S1,                  XXX, NoSensor,      ,                       !!*//
//*!!                                                                            !!*//
//*!!Start automatically generated configuration code.                           !!*//
const tSensors XXX                  = (tSensors) S1;   //NoSensor           //*!!!!*//
//*!!CLICK to edit 'wizard' created sensor & motor configuration.                !!*//

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//                      								Draws a Spiral on the NXT LCD
//
// Contributed by Count Olaf.
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#pragma platform(NXT)

float nAngle;
int X, Y;
float nRadius;

task main()
{
	eraseDisplay();
	while (true)
	{
		//
		// Draw the spiral
		//
		nRadius = 32;
		nAngle = 0;
		while(nRadius > 0)
		{
			X = sinDegrees(nAngle) * nRadius;
			Y = cosDegrees(nAngle) * nRadius;
			nxtSetPixel(X + 50, Y + 32); // Center of screen is (50, 32)
			wait1Msec(1);
			nRadius -=.02;
			++nAngle;
		}
		//
		// Erase the spiral
		//
		while(nRadius <= 32)
		{
			X = sinDegrees(nAngle)  * nRadius;
			Y = cosDegrees(nAngle) * nRadius;
			nxtClearPixel(X + 50, Y + 32); // Center of screen is (50, 32)
			wait1Msec(1);
			nRadius += .02;
			--nAngle;
		}
	}
}