Includes a basic 4-bit binary counter function for the leds.

Dependents:   datalogging_RTC

Revision:
0:805b57b2dd2b
Child:
1:dbabf5266268
diff -r 000000000000 -r 805b57b2dd2b ledCounter.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ledCounter.cpp	Wed Jul 08 11:26:27 2015 +0000
@@ -0,0 +1,16 @@
+#include "ledCounter.h"
+
+DigitalOut led1(LED1); // DigitalOuts are defined for the onboard LPC1768 leds 
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+
+// This function can display value(mod 16) as binary on LPC1768
+// For example =  12 = (1010) led2 and led4 will be ON, led1 and led3 will be OFF.
+void ledCounter(int value)
+{
+    led1=value%2;
+    led2=(value>>1)%2;
+    led3=(value>>2)%2;
+    led4=(value>>3)%2;
+}
\ No newline at end of file