-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_Basic_Control.ino
73 lines (65 loc) · 1.48 KB
/
_Basic_Control.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
66
67
68
69
70
71
72
void brightnessControl() {
float sensorValue = analogRead(potentiometerPIN) / 8.6f;
if (sensorValue > 107) {
sensorValue = 107;
}
if (OVER) {
sensorValue = BRIGHT;
}
if (progBright) {
sensorValue = bright;
}
// Serial.println(int(sensorValue));
matrix.setBrightness(int(sensorValue));
gearString.setBrightness(int(sensorValue));
}
void clearScreen() {
matrix.fillScreen(BLACK);
}
void updateScreen() {
brightnessControl();
unsigned long c = 0;
unsigned long d = micros();
matrix.show();
c = micros();
// Serial.println("Show took " + String(float(c - d) / 1000, 3) + " milliseconds");
if (Serial1.available() > 0) {
roboRioSerial();
}
if (Serial.available() > 0) {
bool a = serialInterp();
if (a) {
quitRun = true;
return;
}
}
}
uint16_t Wheel(byte WheelPos) {
WheelPos = 255 - WheelPos;
if (WheelPos < 85) {
return matrix.Color(255 - WheelPos * 3, 0, WheelPos * 3);
}
if (WheelPos < 170) {
WheelPos -= 85;
return matrix.Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
WheelPos -= 170;
return matrix.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}
void Reset () {
clearScreen();
updateScreen();
progBright = false;
// matrix.setFont(&FONT);
}
void setupPins () {
pinMode(gearSensePin, INPUT_PULLUP);
// attachInterrupt(digitalPinToInterrupt(gearSensePin), pixelAlert, FALLING);
}
void brightOver (int b) {
progBright = true;
bright = b;
}
void error (String message, int code) {
//
}