Bubble display example using NXP PCAL9555A GPIO expander
Fork of PCAL9555_Hello by
Diff: main.cpp
- Revision:
- 1:15df36975a85
- Parent:
- 0:26310705044b
- Child:
- 2:ae0b95d42407
diff -r 26310705044b -r 15df36975a85 main.cpp --- a/main.cpp Sat Mar 07 13:05:21 2015 +0000 +++ b/main.cpp Thu Mar 19 04:22:27 2015 +0000 @@ -1,18 +1,14 @@ -#include "mbed.h" -#include "PCAL9555.h" - -PCAL9555 gpio( p28, p27, 0x40 ); +#include "mbed.h" +#include "PCAL9555.h" -int main() -{ - gpio.configure( 0xFFFF ); // Set all pins: input - printf( " 0x%04X\r\n", (int)gpio );// Print pins state - - gpio.configure( 0x0000 ); // Set all pins: output - - int count = 0; - - while(1) { - gpio.write( count++ ); +PCAL9555 gpio_exp( p28, p27, 0xE8 ); // SDA, SCL, Slave_address(option) +GpioBusOut mypins( gpio_exp, X0_0, X0_1, X0_2, X0_3 ); + +int main() { + while( 1 ) { + for( int i = 0; i < 16; i++ ) { + mypins = i; + wait( 0.1 ); + } } }