Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of ledmatrix02 by
Diff: main.cpp
- Revision:
- 1:eb9338579a76
- Parent:
- 0:e13c5589c250
--- a/main.cpp Sun May 03 01:18:16 2015 +0000
+++ b/main.cpp Wed Dec 23 16:02:40 2015 +0000
@@ -1,50 +1,29 @@
#include "mbed.h"
-#include "Adafruit_LEDBackpack.h"
-#include "Adafruit_GFX.h"
+#include "LedPanel.h"
+#include "LedPanel_GFX.h"
I2C i2c(p9, p10);
DigitalOut myled(LED1);
+LocalFileSystem local("local");
-Adafruit_8x8matrix matrix1 = Adafruit_8x8matrix(&i2c);
-Adafruit_8x8matrix matrix2 = Adafruit_8x8matrix(&i2c);
+LedPanel matrix(&i2c);
int main() {
- int ledon=0;
+ char text[10];
+
+ FILE *fp = fopen("/local/text.txt", "r");
+
+ fgets(text,10,fp);
- matrix1.begin(0x70);
- matrix2.begin(0x71);
- matrix1.setBrightness(15);
- matrix2.setBrightness(4);
+ fclose(fp);
+
+ matrix.begin(0x70,0x71);
+ matrix.setBrightness(1);
+
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);
+ matrix.setCursor(0,0);
+ matrix.printf("%s",text);
+ matrix.writeDisplay();
+ wait(2);
}
}
