This is an example of how to use the DigitalControl, DigitalOut, Timer0, ADChannel0, ADChannel1, SerialInCount, and SerialInByte system constants. It is also an example of how to use the printf, puts, and Wait functions.
task leds()
{
int DigValue = 1;
int DigCount = 8;
int DigLen = 7;
int DigDir = 0;
while(true)
{
DigCount--;
if (DigCount != 0)
{
if (DigDir != 0) {
DigValue >>= 1;
} else
DigValue <<= 1;
continue;
}
DigCount = DigLen;
DigDir ^= 1;
if (DigDir != 0)
{
DigValue >>= 1;
continue;
}
{
case 0:
DigLen = 7;
DigCount = 7;
DigValue = 0x02;
break;
case 1:
DigLen = 6;
DigCount = 6;
DigValue = 0x06;
break;
case 2:
DigLen = 5;
DigCount = 5;
DigValue = 0x0E;
break;
case 3:
DigLen = 4;
DigCount = 4;
DigValue = 0x1E;
break;
case 4:
DigLen = 3;
DigCount = 3;
DigValue = 0x3E;
break;
case 5:
DigLen = 2;
DigCount = 2;
DigValue = 0x7E;
break;
default:
DigLen = 1;
DigCount = 1;
DigValue = 0xFE;
break;
}
}
}
task main()
{
start leds;
int b;
while (true) {
if (b == 'm' || b == 'M')
else if (b == 'H')
else if (b == 'h')
}
else
}
}