--- /dev/null
+/*
+ * LED blinking example for the mbed LPC1768-based board.
+ *
+ * See also: http://bitbucket.org/jpc/lpc1768/
+ *
+ * Copyright (c) 2010 LoEE - Jakub Piotr Cłapa
+ * This program is released under the new BSD license.
+ */
+#include "CMSIS/LPC17xx.h"
+#include "io-pin.h"
+
+// For mbed-005.1
+#define LED1 P1+18
+#define LED2 P1+20
+#define LED3 P1+21
+#define LED4 P1+29
+
+// Helper macros
+#define LED_ON(i) (pin_write (LED##i, 1))
+#define LED_OFF(i) (pin_write (LED##i, 0))
+
+volatile uint32_t current_time;
+
+void SysTick_Handler (void)
+{
+ current_time++;
+}
+
+void delay (uint32_t interval)
+{
+ uint32_t start = current_time;
+ while (current_time - start < interval);
+}
+
+int main (void)
+{
+ // Setup SysTick interrupts at 1kHz (1ms)
+ SysTick_Config (SystemCoreClock / 1000);
+
+ // Configure as output pins.
+ pin_dir (LED1, PIN_OUT);
+ pin_dir (LED2, PIN_OUT);
+ pin_dir (LED3, PIN_OUT);
+ pin_dir (LED4, PIN_OUT);
+
+ // Twinkle!
+ while(1) {
+ LED_OFF(1); delay (120); LED_ON(1);
+ LED_ON(2); delay (120); LED_OFF(2);
+ LED_ON(3); delay (120); LED_OFF(3);
+ LED_ON(4); delay (120); LED_OFF(4);
+ LED_ON(3); delay (120); LED_OFF(3);
+ LED_ON(2); delay (120); LED_OFF(2);
+ }
+}