// // This program controls the brightness of 14 LEDs on a scale from 0 to 13. // As the pattern moves right to left (or clockwise if the LEDs are arranged // in a circle, the brightest LED is at the front, and subsequent LEDs are // each one step dimmer, like the tail of a comet. // unsigned char values[14] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }; unsigned int index = 0; void setup() { P1DIR = 0b11111111; P2DIR = 0b111111; P1OUT = 0; P2OUT = 0; } void loop() { int lights = 0; for( int x = 0; x < 128; x++ ) { lights = 0; for( int y = 0; y < 14; y++ ) { if( x < 1<> 8; } values[index]--; values[index++] &= 0xF; index %= 14; }