added random chance, some progress on pcb

This commit is contained in:
--global
2023-02-12 00:58:04 +02:00
parent 6b190610f2
commit 6cc7bccc9e
9 changed files with 3191 additions and 18 deletions

View File

@ -8,7 +8,7 @@
#define SCREEN_ADDRESS 0x3C
#define PPQN 24
#define PULSE_LENGTH 5 //ms
#define PULSE_LENGTH 15 //ms
#define MAXBPM 250 //250 at 24ppqn with 5ms pulse will be 50/50 square wave
#define MINBPM 20
@ -28,7 +28,7 @@ unsigned int bpm = 130;
struct channel {
unsigned int mode;
int random;
unsigned int random;
bool modulationChannel; //0 - A1, 1 - A2
int modulationRange;
};
@ -76,6 +76,7 @@ RotaryEncoder encoder(ENC_D1_PIN, ENC_D2_PIN, RotaryEncoder::LatchMode::TWO03);
void setup() {
Serial.begin(9600);
//saveState(); //for cases when structure is updated in the code
EEPROM.get(0, bpm);
EEPROM.get(sizeof(int), channels);
@ -126,7 +127,7 @@ void internalClock() {
playingModes[i] = clockModes[channels[i].mode]; //updated here to prevent sync problems for multipliers
if (playingModes[i] > 0) {
if (outsClocksCounts[i] == 0) { //Pulse on 0
if (channels[i].random == 0 || (channels[i].random == 1 && random(2))) { //random
if (channels[i].random == 0 || random(channels[i].random) == 0) { //random
digitalWrite(outsPins[i], HIGH);
}
}