#include "TM1637.h"
#include "Timers.h"
#define VERT_PIN A0
#define HORZ_PIN A1
#define SEL_PIN 4
#define AR_DELAY 100
TM1637 TM;
Timers timer;
int x = 0;
int y = 0;
void setup() {
// Initialize serial
Serial.begin(115200);
// Put your setup code here, to run once:
TM.begin(2, 3); // clock pin, data pin
TM.displayInt(1);
pinMode(VERT_PIN, INPUT);
pinMode(HORZ_PIN, INPUT);
pinMode(SEL_PIN, INPUT_PULLUP);
timer.start(AR_DELAY); //time in ms
// Notify that setup has ended
Serial.println(F("Start"));
}
void loop() {
// put your main code here, to run repeatedly:
if (timer.available()) {
timer.stop();
rd();
TM.displayInt(x);
Serial.println(x);
//Do something
timer.start(AR_DELAY);
}
}
void rd(){
x = analogRead(HORZ_PIN);
y = analogRead(VERT_PIN);
}