-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinput.h
80 lines (71 loc) · 2.28 KB
/
input.h
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
void input_read() {
NTC = analogRead(NTC_pin);
NTC_OHM = 3300 * (((double)NTC / 1024) / (1 - ((double)NTC / 1024)));
TKelvin = 1 / ((1 / ((double)273.15 + 25)) + ((double)1 / 3950) * log((double)NTC_OHM / 2500));
temp = TKelvin - 273.15;
Taster1 = digitalRead(Taster1_pin);
Taster2 = digitalRead(Taster2_pin);
Taster3 = digitalRead(Taster3_pin);
Taster4 = digitalRead(Taster4_pin);
Taster_enco = digitalRead(Taster_enco_pin);
Printer_done = digitalRead(Printer_Bed_pin);
alleTaster = ( Taster1 || Taster2 || Taster3 || Taster4 || Taster_enco);
if (Printer_done == false && printprogress == false) {
printprogress = true;
}
}
void temp_control() {
if (Heizung && temp < soll_temp - 0.5) {
Heizung_relais = true;
}
if (temp > soll_temp + 0.5 || Heizung == false) {
Heizung_relais = false;
}
}
void printer_ready() {
if (printprogress == true && Printer_done == true && printwait == false && allesAndere == false) {
printdelay = Minuten + delay_printer;
printwait = true;
}
if (printdelay <= Minuten && printdelay != 0 && printprogress == true && allesAndere == false && printwait == true) {
SystemON = false;
}
}
void taster() {
if (Taster1 == true && Taster1_alt == false && waittime < millis()) {
drucker = !drucker;
Taster1_alt = true;
ledcWriteTone(channel, freq);
delay(Beeptime);
ledcWriteTone(channel, 0);
waittime = millis() + tasterdelay;
}
if (!Taster1) Taster1_alt = false;
if (Taster2 == true && Taster2_alt == false && waittime < millis()) {
licht = !licht;
Taster2_alt = true;
ledcWriteTone(channel, freq);
delay(Beeptime);
ledcWriteTone(channel, 0);
waittime = millis() + tasterdelay;
}
if (!Taster2) Taster2_alt = false;
if (Taster3 == true && Taster3_alt == false && waittime < millis()) {
tools = !tools;
Taster3_alt = true;
ledcWriteTone(channel, freq);
delay(Beeptime);
ledcWriteTone(channel, 0);
waittime = millis() + tasterdelay;
}
if (!Taster3) Taster3_alt = false;
if (Taster4 == true && Taster4_alt == false && waittime < millis()) {
PC = !PC;
Taster4_alt = true;
ledcWriteTone(channel, freq);
delay(Beeptime);
ledcWriteTone(channel, 0);
waittime = millis() + tasterdelay;
}
if (!Taster4) Taster4_alt = false;
}