Example program for LPC General Purpose Shield using LEDs

Dependencies:   PCAL955x mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "PCAL9555.h"
00003  
00004 PCAL9555    gpio_exp(SDA, SCL);
00005 GpioBusOut  leds(gpio_exp, X1_4, X1_5, X1_6, X1_7);
00006  
00007 enum key_num {
00008     OM13082_LD1 = (1 << 0),
00009     OM13082_LD2 = (1 << 1),
00010     OM13082_LD3 = (1 << 2),
00011     OM13082_LD4 = (1 << 3),
00012 };
00013  
00014 int main()
00015 {
00016     while(1) {
00017         leds.write(0xF);
00018         wait(0.3);
00019         leds.write(~OM13082_LD1);
00020         wait(0.3);
00021         leds.write(~OM13082_LD2);
00022         wait(0.3);
00023         leds.write(~OM13082_LD3);
00024         wait(0.3);
00025         leds.write(~OM13082_LD4);
00026         wait(0.3);
00027     }
00028 }
00029