Compare commits
4 Commits
824811ea24
...
105817a3a7
Author | SHA1 | Date |
---|---|---|
Stefan | 105817a3a7 | |
Stefan | 1c742c2004 | |
Stefan | 9b674f0c56 | |
Stefan | d296d7b810 |
|
@ -1,18 +1,52 @@
|
|||
Encoder rotEncoder(2, 3);
|
||||
const int buttonPin = 4;
|
||||
|
||||
int buttonState;
|
||||
int lastButtonState = HIGH;
|
||||
|
||||
unsigned long lastDebounceTime = 0;
|
||||
unsigned long debounceDelay = 50;
|
||||
|
||||
Encoder rotEncoder(3, 2);
|
||||
|
||||
void Encoder_Init(void) {
|
||||
pinMode(buttonPin, INPUT_PULLUP);
|
||||
|
||||
Serial.print("Encoder position: ");
|
||||
Serial.println(EncPos);
|
||||
}
|
||||
|
||||
void Encoder_Task(void) {
|
||||
int reading;
|
||||
reading = digitalRead(buttonPin);
|
||||
|
||||
if (reading != lastButtonState) {
|
||||
lastDebounceTime = millis();
|
||||
}
|
||||
|
||||
if ((millis() - lastDebounceTime) > debounceDelay) {
|
||||
if (reading != buttonState) {
|
||||
buttonState = reading;
|
||||
|
||||
if (buttonState == LOW) {
|
||||
Serial.println("Button pressed");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
lastButtonState = reading;
|
||||
|
||||
long newEncPos;
|
||||
newEncPos = rotEncoder.read();
|
||||
rotEncoder.write(0);
|
||||
|
||||
|
||||
if (newEncPos != EncPos) {
|
||||
Serial.print("Encoder position = ");
|
||||
Serial.print(newEncPos);
|
||||
Serial.println();
|
||||
if (newEncPos > 0) {
|
||||
Serial.println("Encoder right");
|
||||
EncPos = newEncPos;
|
||||
}
|
||||
|
||||
if (newEncPos < 0) {
|
||||
Serial.println("Encoder left");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ unsigned long timer1000 = 0;
|
|||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
Serial.begin(57600);
|
||||
Serial.println("Reflow Controller v00.01");
|
||||
|
||||
Encoder_Init();
|
||||
|
@ -63,7 +63,7 @@ void loop() {
|
|||
timer1000 = millis();
|
||||
|
||||
Reflow_Task();
|
||||
}
|
||||
|
||||
Display_Task(); // so oft wie möglich
|
||||
Display_Task();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#define MAXDO 7
|
||||
#define MAXCS 8
|
||||
#define MAXCLK 9
|
||||
#define MAXCS 6
|
||||
#define MAXCLK 8
|
||||
|
||||
MAX6675 thermocouple(MAXCLK, MAXCS, MAXDO);
|
||||
|
||||
|
|
Loading…
Reference in New Issue