User manual
LPCXpresso Experiment Kit - User’s Guide
Page 46
Copyright 2013 © Embedded Artists AB
7.4 Control Multiple LEDs
In this experiment you will learn how to control multiple I/O pins simultaneously. More specifically you
will learn how to control eight LEDs. This experiment builds on the knowledge you have gained from
the previous experiments.
7.4.1 Lab 3a: LEDs in Running-One Pattern
As a start, create the circuit with 8 LEDs and two push-buttons as illustrated in Figure 18 below. Only
one push-button is used in this experiment but in the two next, two are needed. Have a look at page 4
in the schematic to get al LED and push-button connections. LED1-LED8 and SW2-SW3 are mounted.
All resistors are 330 ohm.
Figure 18 – Breadboard Connections for 8 LEDs and two Push-buttons
In this experiment the 8 LEDs shall be controlled in a running-one pattern. First let the running rate be
fixed. Use the delay function from previous experiments as the time base. The program structure is
suggested to be as below. 1) Wait a fixed time, 2) Update the state variable (or counter, which is
technically also a state) and 3) set outputs according to state.
//Declare variables
...
//Initialize pins to be inputs and outputs,
// set outputs to defined states
...
//Enter forever loop
while (1)
{
//Delay a specified period of time or wait for push-button to be pressed
...
//Update state/counter
...