Hello world program using the SX1509 Library for controlling a 8x8 LED matrix.

Dependencies:   SX1509 mbed

Files at this revision

API Documentation at this revision

Comitter:
jjones646
Date:
Tue Oct 21 15:43:13 2014 +0000
Commit message:
storing hello world program

Changed in this revision

SX1509.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 a93ac8eaed5e SX1509.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SX1509.lib	Tue Oct 21 15:43:13 2014 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/jjones646/code/SX1509/#fd95a990c3b7
diff -r 000000000000 -r a93ac8eaed5e main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Oct 21 15:43:13 2014 +0000
@@ -0,0 +1,34 @@
+#include "mbed.h"
+#include "SX1509.h"
+ 
+#define WAIT_TIME 0.1
+ 
+DigitalOut led1(LED1);
+SX1509  expander(p9, p10); // sda, scl
+ 
+int main()
+{
+    // Setup the I/O pins for open drain outputs to allow controlling grid of LEDs
+    expander.setOpenDrain(A,ON);
+    
+    // Main loop
+    while (1) {
+        
+        // Set the "A" rows to high, then shift the open drain outputs so they open for each row of LEDs
+        for (int i=0; i<8 ; i++) {
+            expander.setA(0xFF<<i+1);
+            expander.set(i+8);
+            wait(WAIT_TIME);
+        }
+ 
+        // Toggle the on-board led to indicate activity
+        led1=!led1;
+ 
+        // Now shift the rows off the led grid array
+        for (int i=0; i<8 ; i++) {
+            expander.setB(0xFF>>i+1);
+            expander.clear(i);
+            wait(WAIT_TIME);
+        }
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r a93ac8eaed5e mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Oct 21 15:43:13 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file