writing values in a led bus

Dependencies:   Hotboards_leds mbed

Files at this revision

API Documentation at this revision

Comitter:
RomanValenciaP
Date:
Mon Feb 29 20:00:08 2016 +0000
Commit message:
leds

Changed in this revision

Hotboards_leds.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 2f277fc001e3 Hotboards_leds.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Hotboards_leds.lib	Mon Feb 29 20:00:08 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/Hotboards/code/Hotboards_leds/#ea0715867677
diff -r 000000000000 -r 2f277fc001e3 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Feb 29 20:00:08 2016 +0000
@@ -0,0 +1,42 @@
+
+/*
+ * Write a variable into a led bus
+ *
+ * Connections:
+ *
+ * PA_5 --- led0
+ * PA_6 --- led1
+ * PA_7 --- led2
+ * PB_6 --- led3
+ * PC_7 --- led4
+ * PA_9 --- led5
+ * PA_8 --- led6
+ * PB_10 --- led8
+ *
+ */
+
+#include "mbed.h"
+#include "Hotboards_leds.h"
+
+//Creates a bus with 8 leds
+//                 bit 7   bit 6  bit 5  bit 4  bit 3  bit 2  bit 1  bit 0
+Hotboards_leds leds( PB_10 , PA_8 , PA_9 , PC_7 , PB_6 , PA_7 , PA_6 , PA_5 );
+
+uint8_t counter;
+
+int main()
+{
+    counter = 0;
+    while(1)
+    {
+        //Shows on the led bus the counter variable value
+        leds.write( counter );
+        wait_ms( 500 );
+        counter ++;
+        //We can still manipulate each led individually with
+        //the functions turnOn, turnOff, toggle, write, but in
+        //this case the function will need a parameter indicating
+        //the led you want to manipulate
+        //Example: leds.turnOn(3) turns ON led #3
+    }
+}
diff -r 000000000000 -r 2f277fc001e3 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Feb 29 20:00:08 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/252557024ec3
\ No newline at end of file