-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMultiShift.ino
65 lines (54 loc) · 1.69 KB
/
MultiShift.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "MatrixCascade.h"
//
//
// This example clearly shows the difference in the speed between the hardware and software SPI
//
//
// pin 11 is connected to the DataIn
// pin 13 is connected to the CLK
// pin 10 is connected to LOAD
const uint8_t CascadeSize = 3;
// Software SPI:
//MatrixCascade<CascadeSize> cascade(11, 13, 10);
// Hardware SPI:
MatrixCascade<CascadeSize> cascade(10);
const uint8_t picsCount = 3;
const uint8_t pics[3][8] = {
//{0b10000011, 0b10000111, 0b10001001, 0b11010010, 0b11110100, 0b11010010, 0b10001001, 0b10000111},
//{0b11111111, 0b10000001, 0b10111101, 0b10100101, 0b10100101, 0b10111101, 0b10000001, 0b11111111},
//{0b10011001, 0b01011010, 0b00111100, 0b11111111, 0b11111111, 0b00111100, 0b01011010, 0b10011001},
{B00000000, B00000000, B10001000, B11011001, B10101010, B10001011, B10001010, B00000000},
{B00000000, B00000000, B00000000, B00010010, B10111011, B10010010, B10011010, B00000000},
{B00000000, B00100000, B00000000, B10101001, B00100010, B00100100, B00101001, B00000000},
};
void setup()
{
cascade.setIntensity(0);
// Rotate some matrixes
cascade[1].setRotation(2);
cascade[2].setRotation(2);
for (auto &matrix: cascade)
{
matrix.set(pics[matrix.index()]);
}
}
const uint8_t matrixSize = 8;
void loop()
{
//
// Shifting Right
//
//iterate over colomns
for (uint8_t i = 0; i < matrixSize; ++i)
{
// get last colomn in cascade
auto LastCol = cascade[CascadeSize - 1].getCol(matrixSize - 1);
for (auto &matrix: cascade)
{
LastCol = matrix.shiftRight(LastCol);
delay(20);
}
//delay(100);
}
//delay(100);
}