This commit is contained in:
--global
2023-03-16 00:59:41 +02:00
parent 2d4f39125d
commit 7edd4eae85
32 changed files with 77682 additions and 80 deletions

View File

@ -13,14 +13,14 @@
#define MINBPM 20
#define INPUT_PIN 2 //needs to be an interrupt pin
#define ENC_BTN_PIN 17
#define ENC_D1_PIN 4
#define ENC_D2_PIN 3
#define START_STOP_BTN_PIN 14
#define ANALOGUE_INPUT_1_PIN A1
#define ENC_BTN_PIN 14 //3 //21
#define ENC_D1_PIN 17 //12 //20
#define ENC_D2_PIN 4 //4 //17
#define START_STOP_BTN_PIN 5
#define ANALOGUE_INPUT_1_PIN A2
#define ANALOGUE_INPUT_2_PIN A1
const int outsPins[6] = {5, 6, 7, 8, 9, 10};
const int outsPins[6] = {6, 11, 7, 10, 8, 9}; //{6, 9, 7, 10, 11, 8}
const int clockModes[18] = {-24, -16, -12, -8, -6, -4, -3, -2, 1, 2, 3, 4, 5, 6, 7, 8, 16, 32}; //positive - divide, negative - multiply, 0 - off
@ -74,7 +74,7 @@ Adafruit_SSD1306 display(128, 64, &Wire, -1);
RotaryEncoder encoder(ENC_D1_PIN, ENC_D2_PIN, RotaryEncoder::LatchMode::TWO03);
void setup() {
Serial.begin(9600);
//Serial.begin(9600);
//saveState(); //for cases when structure is updated in the code
EEPROM.get(0, bpm);
@ -84,7 +84,7 @@ void setup() {
pinMode(START_STOP_BTN_PIN, INPUT_PULLUP);
pinMode(START_STOP_BTN_PIN, ANALOGUE_INPUT_1_PIN);
pinMode(INPUT_PIN, INPUT_PULLUP); //probably will need interrupt
attachInterrupt(digitalPinToInterrupt(INPUT_PIN), externalClock, RISING);
//attachInterrupt(digitalPinToInterrupt(INPUT_PIN), externalClock, RISING);
for (int i=0; i<6; i++) {
pinMode(outsPins[i], OUTPUT);
@ -184,9 +184,9 @@ void internalClock() {
}
}
void externalClock() {
digitalWrite(outsPins[0], !digitalRead(outsPins[0]));
}
//void externalClock() {
// digitalWrite(outsPins[0], !digitalRead(outsPins[0]));
//}
void updateTiming() {
pulsePeriod = 60000 / (bpm * PPQN);