this program works with my pcb only

Dependencies:   Adafruit_LEDBackpack mbed

main.cpp

Committer:
sibu2
Date:
2015-05-03
Revision:
0:e13c5589c250

File content as of revision 0:e13c5589c250:

#include "mbed.h"
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
 
I2C i2c(p9, p10);
DigitalOut myled(LED1);

Adafruit_8x8matrix matrix1 = Adafruit_8x8matrix(&i2c);
Adafruit_8x8matrix matrix2 = Adafruit_8x8matrix(&i2c);
 
int main() {
    int ledon=0;
    
    matrix1.begin(0x70);
    matrix2.begin(0x71);
    matrix1.setBrightness(15);
    matrix2.setBrightness(4);
    while(1) {
        matrix1.clear();
        matrix2.clear();
#if 1
        for (int y = 0; y < 8; y++) {
          for (int x = 0; x < 16; x++) {
              matrix1.drawPixel(x, y, LED_ON);  
              matrix2.drawPixel(15-x, 7-y, LED_ON);  
              matrix1.writeDisplay();  // write the changes we just made to the display
              matrix2.writeDisplay();  // write the changes we just made to the display
              wait_ms(10);
              myled=(ledon^=1);
          }
        }
        wait(1);

        for (int y = 0; y < 8; y++) {
          for (int x = 0; x < 16; x++) {
              matrix1.drawPixel(x, y, LED_OFF);  
              matrix2.drawPixel(15-x, 7-y, LED_OFF);  
              matrix1.writeDisplay();  // write the changes we just made to the display
              matrix2.writeDisplay();  // write the changes we just made to the display
              wait_ms(10);
              myled=(ledon^=1);
          }
        }
#else
        matrix1.writeDisplay();  // write the changes we just made to the display
        matrix2.writeDisplay();  // write the changes we just made to the display
#endif
        wait(1);
    }
}