-
Notifications
You must be signed in to change notification settings - Fork 3
/
Display.ino
56 lines (44 loc) · 1.89 KB
/
Display.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
void updateDisplay() { // update LCD readout
if (doOutput){
doOutput=false;
// For diagnostic comment out later
Serial.print("X, "); Serial.print(XaxisSetpoint);Serial.print(", "); Serial.print(XaxisPos);Serial.print(", "); Serial.print(XaxisSpd);
Serial.print(", "); Serial.print(KpX); Serial.print(", "); Serial.print(KiX); Serial.print(", "); Serial.print(KdX);
Serial.print(", "); Serial.print(millis()-timeToAcquire);Serial.print("\r\n");
Serial.print("Y, "); Serial.print(YaxisSetpoint);Serial.print(", "); Serial.print(YaxisPos);Serial.print(", "); Serial.print(YaxisSpd);
Serial.print(", "); Serial.print(KpY); Serial.print(", "); Serial.print(KiY); Serial.print(", "); Serial.print(KdY);
Serial.print(", "); Serial.print(millis()-timeToAcquire);Serial.print("\r\n");
lcd.setCursor(0, 0);
lcd.print("XTarget "); lcd.print(XaxisSetpoint,2);lcd.print(" ");
lcd.setCursor(0, 1);
sprintf(disbuffer, "%6d", rtX);
lcd.print("XPosition "); lcd.print(disbuffer);
lcd.setCursor(0, 2);
digitalClockDisplay();
}
}
void displaySetpoints() {
Serial.print("XaxisSetpoint = "); Serial.print(XaxisSetpoint); Serial.print("\n\r");
Serial.print("YaxisSetpoint = "); Serial.print(YaxisSetpoint); Serial.print("\n\r");
lcd.setCursor(0, 3);
lcd.print("X = "); lcd.print(XaxisSetpoint); lcd.print(", ");
lcd.print("Y = "); lcd.print(YaxisSetpoint);
}
void digitalClockDisplay() {
// digital clock display of the time
lcd.print(hour());
printDigits(minute());
printDigits(second());
lcd.print(" ");
lcd.print(month());
lcd.print(" ");
lcd.print(day());
lcd.print(" ");
lcd.print(year());
}
void printDigits(int digits){
// utility function for digital clock display: prints preceding colon and leading 0
lcd.print(":");
if(digits < 10) lcd.print('0');
lcd.print(digits);
}