/*----------------------------------------------------------------------------
* Name: blinky.c
* Purpose: LED Flasher
*----------------------------------------------------------------------------*/
#include <lpc17xx.h> // LPC17xx definitions
/*----------------------------------------------------------------------------
wait function
*----------------------------------------------------------------------------*/
void wait (void)
{
int d;
for (d = 0; d < 2000000; d++); // only to delay for LED flashes
}
/*----------------------------------------------------------------------------
Main Program
*----------------------------------------------------------------------------*/
int main (void)
{
LPC_GPIO2->FIODIR = 0x01; // LEDs on PORT2 are output
while (1) // Loop forever
{
LPC_GPIO2->FIOSET = 0x01; // Turn LED on
wait(); // call wait function
LPC_GPIO2->FIOCLR = 0x01; // Turn LED off
wait(); // call wait function
}
}