while (1)
{
// cycles led according to brightness
if (!counter[C_TEST])
{
if (lighton == 1)
{
lighton = 0;
ledBits = 0x03;
setCounter(C_TEST,brightness);
}
else
{
lighton = 1;
ledBits = 0x00;
setCounter(C_TEST,10-brightness);
}
serviceLEDs();
}
//causes fade variable to slowly increase and decrease from 1 to 10 and back
if (!counter[C_TEST2])
{
setCounter(C_TEST2,2400);
if (fadedirection == 0)
{
brightness--;
if(brightness <= 0){fadedirection = 1;}
}
else
{
brightness++;
if(brightness >= 10){fadedirection = 0;}
}
}
}
}