Project Karibu: Pretty lights for ECE2031.

[KNfLrPn Home]

- Navigation -

- Links -

- Download -

Push buttons and LEDs.

Green LED animation

The push buttons (PBs) control the green LEDs above them, though not directly per se. The block diagram for the system is shown below:

Push button system block diagram.


The device LED_FADE_8 is an 8-channel, 8-bit PWM generator, the output of which controls the eight green LEDs on the DE2 board. The PWM signals are ~390Hz, so the strobing is only noticeable if the board is moved very quickly.

As well as generating the PWM signal, LED_FADE_8 also smoothly transitions between input values; i.e. if the input changes from 0 to 255, the output will smoothly fade from fully off to fully on over ~0.75 seconds.


The device LED_GLOW provides the 8-bit value to be assigned to the LEDs, taking the PBs as inputs. With no PBs active, the outputs default to 28/255. If a PB is active, a set of weights are added to all LED values, with large positive weights added to LEDs near the PB and negative weights added to those far away. This gives the effect of 'pulling' the aggregate light towards the active PB(s). If all PBs are active at once, all LEDs assume a maximum value.