#define clk 5
#define dt 6
#define sw 7
uint8_t clk_state, dt_state, sw_state;
void setup() {
// put your setup code here, to run once:
pinMode(clk, INPUT_PULLUP);
pinMode(dt, INPUT_PULLUP);
pinMode(sw, INPUT_PULLUP);
clk_state = digitalRead(clk);
dt_state = digitalRead(dt);
sw_state = digitalRead(sw);
Serial.begin(57600);
Serial.println("Booting");
Serial.print(dt_state);
Serial.println(clk_state);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(clk) != clk_state) {
clk_state = digitalRead(clk);
Serial.print(dt_state);
Serial.println(clk_state);
}
if (digitalRead(dt) != dt_state) {
dt_state = digitalRead(dt);
Serial.print(dt_state);
Serial.println(clk_state);
}
}