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:
- 0:e13c5589c250
- Child:
- 1:eb9338579a76
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sun May 03 01:18:16 2015 +0000
@@ -0,0 +1,50 @@
+#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);
+ }
+}
