-
Notifications
You must be signed in to change notification settings - Fork 0
/
SquaresState.cpp
80 lines (69 loc) · 1.58 KB
/
SquaresState.cpp
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
* Squares.cpp
*
* Created on: 25.12.2019
* Author: fahri
*/
#include "SquaresState.h"
#include "LineState.h"
SquaresState::SquaresState() {
byte* frame1 = new byte[8];
frame1[0] = B00000000;
frame1[1] = B00000000;
frame1[2] = B00000000;
frame1[3] = B00011000;
frame1[4] = B00011000;
frame1[5] = B00000000;
frame1[6] = B00000000;
frame1[7] = B00000000;
byte* frame2 = new byte[8];
frame2[0] = B00000000;
frame2[1] = B00000000;
frame2[2] = B00111100;
frame2[3] = B00100100;
frame2[4] = B00100100;
frame2[5] = B00111100;
frame2[6] = B00000000;
frame2[7] = B00000000;
byte* frame3 = new byte[8];
frame3[0] = B00000000;
frame3[1] = B01111110;
frame3[2] = B01000010;
frame3[3] = B01000010;
frame3[4] = B01000010;
frame3[5] = B01000010;
frame3[6] = B01111110;
frame3[7] = B00000000;
byte* frame4 = new byte[8];
frame4[0] = B11111111;
frame4[1] = B10000001;
frame4[2] = B10000001;
frame4[3] = B10000001;
frame4[4] = B10000001;
frame4[5] = B10000001;
frame4[6] = B10000001;
frame4[7] = B11111111;
framesSize = 4;
frames = new byte*[framesSize];
frames[0] = frame1;
frames[1] = frame2;
frames[2] = frame3;
frames[3] = frame4;
}
SquaresState::~SquaresState() {
for (int i = 0; i < framesSize; i++) {
delete frames[i];
}
delete frames;
}
State* SquaresState::next() {
return new LineState();
}
void SquaresState::drawOnScreen(LedControl *lc) {
for (int i = 0; i < framesSize; i++) {
for (int j = 0; j < 8; j++) {
lc->setRow(0, j, frames[i][j]);
}
delay(200);
}
}