![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Hello world program using the SX1509 Library for controlling a 8x8 LED matrix.
Revision 0:a93ac8eaed5e, committed 2014-10-21
- Comitter:
- jjones646
- Date:
- Tue Oct 21 15:43:13 2014 +0000
- Commit message:
- storing hello world program
Changed in this revision
--- /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
--- /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
--- /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