March Madness - LED 7 segment

Hacking with Jason, Keith and Rick. Jason had the 7 segment serial display from sparkfun. We wanted to experiment with it. This uses the Arduino mega serial port 3. It changes the brightness as it goes.




#include	"HardwareSerial.h"

byte	theIndex;

char	validData[]	=	"0123456789ABCDEF";
int		brightness;




//**********************************************************
void setup()
{
//	Serial.begin(9600);
	Serial3.begin(9600);
	
	
	theIndex	=	0;
	brightness	=	0;
	
	delay(300);
	Serial3.print(0x7A, BYTE);
	delay(100);
	Serial3.print(0, BYTE);
	delay(100);
}



//**********************************************************
void loop()
{
int	ii;

	Serial3.print(0x7A, BYTE);
	Serial3.print(brightness, BYTE);

	for (ii=0; ii<4; ii++)
	{
		Serial3.print(validData[theIndex], BYTE);
	}
	delay(200);

	theIndex++;
	
	if (validData[theIndex] == 0)
	{
		theIndex	=	0;
	}
	
	brightness	+=	10;
	if (brightness > 255)
	{
		brightness	=	0;
	}
}