-
Notifications
You must be signed in to change notification settings - Fork 1
/
motorcycle_gauge.ino4966525881754801240.tmp
90 lines (53 loc) · 1.28 KB
/
motorcycle_gauge.ino4966525881754801240.tmp
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
81
82
83
84
85
86
87
88
89
90
#include "Adafruit_HT1632.h"
#define HT_DATA 2
#define HT_WR 3
#define HT_CS 4
#define HT_CS2 5
// use this line for single matrix
Adafruit_HT1632LEDMatrix matrix = Adafruit_HT1632LEDMatrix(HT_DATA, HT_WR, HT_CS);
// tweenio
//////////////////////////////
// Graphics for big numbers ///
bool getBit(unsigned char byte, int position) // position in range 0-7
{
return (byte >> position) & 0x1;
}
class MatrixElement {
public:
MatrixElement();
bool visible = true;
virtual void render(int px, int py);
virtual void addChild(MatrixElement* elem);
int x = 0;
int y = 0;
MatrixElement * children[10];
};
MatrixElement::MatrixElement() {
Serial.print("sdf");
}
void MatrixElement::addChild(MatrixElement* elem) {
};
void MatrixElement::render(int px, int py) {
};
class Counter : public MatrixElement {
public:
Counter() : MatrixElement() {};
};
MatrixElement stage;
Counter counter;
void setup() {
Serial.begin(9600);
matrix.begin(ADA_HT1632_COMMON_16NMOS);
stage.addChild(&counter);
//Serial.print(screen.buffer[1]);
}
void loop() {
matrix.clearScreen();
// draw elements //
stage.render(0, 0);
for (int i = 0; i < 50; i++) {
matrix.setPixel(random() % 24, random() % 16);
}
matrix.writeScreen();
delay(10);
}