diff --git a/libraries/Arduino_LED_Matrix/examples/MatrixIntro/MatrixIntro.ino b/libraries/Arduino_LED_Matrix/examples/MatrixIntro/MatrixIntro.ino new file mode 100644 index 000000000..ea284dc35 --- /dev/null +++ b/libraries/Arduino_LED_Matrix/examples/MatrixIntro/MatrixIntro.ino @@ -0,0 +1,47 @@ +/* + Heart Animation Sketch + + This is the default sketch that comes + shipped with every UNO R4 WiFi board. + + After the animation (a heart) is complete, + the built-in LED blinks infinitely. + + No additional circuit required. + + created 26 Jun 2023 + by Martino Facchin +*/ + + +// include the LED Matrix library from the Uno R4 core: +#include "Arduino_LED_Matrix.h" +// make an instance of the library: +ArduinoLEDMatrix matrix; +//include the "animation.h" header file that stores the frames for the animation +#include "animation.h" + +void setup() { + Serial.begin(115200); + //load frames from the animation.h file + matrix.loadSequence(frames); + // start the matrix + matrix.begin(); + + // turn on autoscroll to avoid calling next() to show the next frame; the paramenter is in milliseconds + // matrix.autoscroll(300); + + //play the animation on the matrix + matrix.play(true); + + //define LED_BUILTIN as an output + pinMode(LED_BUILTIN, OUTPUT); +} + +void loop() { + //blinks the built-in LED every second + digitalWrite(LED_BUILTIN, HIGH); + delay(1000); + digitalWrite(LED_BUILTIN, LOW); + delay(1000); +} diff --git a/libraries/Arduino_LED_Matrix/examples/MatrixIntro/animation.h b/libraries/Arduino_LED_Matrix/examples/MatrixIntro/animation.h new file mode 100644 index 000000000..c1944b3a8 --- /dev/null +++ b/libraries/Arduino_LED_Matrix/examples/MatrixIntro/animation.h @@ -0,0 +1,351 @@ +#include +const unsigned long frames[][4] = { + { + 0xe0000000, + 0x0, + 0x0, + 66 + }, + { + 0x400e0000, + 0x0, + 0x0, + 66 + }, + { + 0x400e0, + 0x0, + 0x0, + 66 + }, + { + 0x40, + 0xe000000, + 0x0, + 66 + }, + { + 0x3000000, + 0x400e000, + 0x0, + 66 + }, + { + 0x3003000, + 0x400e, + 0x0, + 66 + }, + { + 0x3003, + 0x4, + 0xe00000, + 66 + }, + { + 0x3, + 0x300000, + 0x400e00, + 66 + }, + { + 0x0, + 0x300300, + 0x400e00, + 66 + }, + { + 0x1c000000, + 0x300, + 0x30400e00, + 66 + }, + { + 0x401c000, + 0x0, + 0x30430e00, + 66 + }, + { + 0x401c, + 0x0, + 0x430e30, + 66 + }, + { + 0x4, + 0x1c00000, + 0x430e30, + 66 + }, + { + 0x0, + 0x401c00, + 0x430e30, + 66 + }, + { + 0x800000, + 0x401, + 0xc0430e30, + 66 + }, + { + 0x800800, + 0x0, + 0x405f0e30, + 66 + }, + { + 0x800800, + 0x80000000, + 0x470ff0, + 66 + }, + { + 0x800800, + 0x80080000, + 0x470ff0, + 66 + }, + { + 0x800, + 0x80080080, + 0x470ff0, + 66 + }, + { + 0x38000000, + 0x80080080, + 0x8470ff0, + 66 + }, + { + 0x10038000, + 0x80080, + 0x8478ff0, + 66 + }, + { + 0x10038, + 0x80, + 0x8478ff8, + 66 + }, + { + 0x700010, + 0x3800080, + 0x8478ff8, + 66 + }, + { + 0x400700, + 0x1003880, + 0x8478ff8, + 66 + }, + { + 0x400, + 0x70001083, + 0x88478ff8, + 66 + }, + { + 0xf000000, + 0x40070081, + 0x87f8ff8, + 66 + }, + { + 0xf000, + 0x400f1, + 0x87f8ff8, + 66 + }, + { + 0x8000000f, + 0xc1, + 0xf7f8ff8, + 66 + }, + { + 0xc0080000, + 0xf00081, + 0xc7ffff8, + 66 + }, + { + 0x400c0080, + 0xf81, + 0x87fcfff, + 66 + }, + { + 0x3400c0, + 0x8000081, + 0xf87fcfff, + 66 + }, + { + 0x20200340, + 0xc008081, + 0xf87fcfff, + 66 + }, + { + 0x38220200, + 0x3400c089, + 0xf87fcfff, + 66 + }, + { + 0x38220, + 0x2003408d, + 0xf8ffcfff, + 66 + }, + { + 0x86100038, + 0x220240bd, + 0xf8ffcfff, + 66 + }, + { + 0xec186100, + 0x38260ad, + 0xfbffcfff, + 66 + }, + { + 0x3ec186, + 0x100078af, + 0xfaffffff, + 66 + }, + { + 0x114003ec, + 0x186178af, + 0xfaffffff, + 66 + }, + { + 0x3b411400, + 0x3ec1febf, + 0xfaffffff, + 66 + }, + { + 0x143b411, + 0x4ec3febf, + 0xfbffffff, + 66 + }, + { + 0xc040143b, + 0x4fd7febf, + 0xfbffffff, + 66 + }, + { + 0xc60c0439, + 0x4ff7ffff, + 0xfbffffff, + 66 + }, + { + 0x33c60f9, + 0x4ff7ffff, + 0xffffffff, + 66 + }, + { + 0x3cbc33ff, + 0x4ff7ffff, + 0xffffffff, + 66 + }, + { + 0x8ffbff, + 0x7ff7ffff, + 0xffffffff, + 66 + }, + { + 0xf0cffbff, + 0xfff7ffff, + 0xffffffff, + 66 + }, + { + 0xfe1fffff, + 0xffffffff, + 0xffffffff, + 66 + }, + { + 0xffffffff, + 0xffffffff, + 0xffffffff, + 66 + }, + { + 0x7fffffff, + 0xffffffff, + 0xfffff7ff, + 66 + }, + { + 0x3fe7ffff, + 0xffffffff, + 0xff7ff3fe, + 66 + }, + { + 0x1fc3fe7f, + 0xfffffff7, + 0xff3fe1fc, + 66 + }, + { + 0xf81fc3f, + 0xe7ff7ff3, + 0xfe1fc0f8, + 66 + }, + { + 0x500f81f, + 0xc3fe3fe1, + 0xfc0f8070, + 66 + }, + { + 0x500f, + 0x81fc1fc0, + 0xf8070020, + 66 + }, + { + 0x5, + 0xf80f80, + 0x70020000, + 66 + }, + { + 0x5, + 0xa80880, + 0x50020000, + 600 + }, + { + 0xd812, + 0x41040880, + 0x50020000, + 200 + }, + { + 0x5, + 0xa80880, + 0x50020000, + 0xFFFFFFFF + } +};