male header will be used to connect the batteries and
female header. Other than the headers, the carrier board is
built step by step, according to the instructions. When using
the AthenaHS with the carrier board, you will need a 20 MHz
Once the LEDs have been inserted, you can slightly
bend them into groups, as shown in Figure 4. The short
LED lead connects to the outside header (vss). If you are
worried about the leads touching, you can use some 1/16
heat shrink for insulation. You only need to insulate the IO
port side of the LED.
Use double-sided foam tape to attach the circuit
board to the battery holder. The LEDs should be centered
on the battery holder, as shown in Figure 5. To turn on the
light, slip the battery header over the two pin header on
the board. The negative side of the battery is connected
to the header pin closest to the LEDs.
The program must generate six PWM signals on ports
0-5. Three counter variables — named bluecount,
redcount, and greencount — set the duty cycle of the
The color pattern is set in the main loop. We start
with red and green turned on and proceed as follows:
Fade out red.
Fade in blue.
Fade out green.
Fade in red.
Fade out blue.
Fade in green.
This pattern assures that all the LED color combos
are met. It also means no more than four LEDs are on at
once, which will go a long way in reducing power
The actual call to the PWM routine is what lights the
LEDs. At the start of this routine, we retrieve a random
number to set the number of times we will actually cycle
through the PWM counts. The more times we cycle, the
longer it will take a particular color to fade in or out.
NUTS & VOLTS
const portblue1 0
const portred1 1
const portgreen1 2
const portblue2 3
const portred2 4
const portgreen2 5
const maxcount 150
‘Sets up the PWM
frequency and resolution
‘Start Point for lights