<commit_before>/*
  Test Code for the Pure Quantiser LEDs.

  LEDs should light in the following in order from top to bottom, for 1/2sec each
*/

#include "SPI.h"
#include <EEPROM.h>

//Setup LED Pin Varibles
const byte LR_0 = A3;
const byte LR_1 = A4;
const byte LR_2 = A5;
const byte LR_3 = 7;
const byte LC_0 = A0;
const byte LC_1 = A1;
const byte LC_2 = A2;

//Setup Button Pin Variable
const byte BC_0 = 2;
const byte BC_1 = 1;
const byte BC_2 = 0;
const byte BR_0 = 3;
const byte BR_1 = 4;
const byte BR_2 = 5;
const byte BR_3 = 6;

//Setup variable for the buttons, LEDs and temperament
int note;
int notes[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

int equalTempered[13] = {0, 68, 136, 205, 273, 341, 409, 478, 546, 614, 682, 751, 819};


//Setup program control variables
int mode = 0;
int i = 1;

//Setup switch debounce variables
unsigned long lastDebounceTime = 0;
unsigned long debounceDelay = 500;
int buttonState;
int lastButtonState[13] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

//Setup SPI Bus Pin Variables
const byte csADC = 9;
const byte csDAC = 10;

//Setup CV and Trigger Pin Variables
int cvIn;
int cvOut;
int lastCvOut;
int lastCvChange;
int triggerOnTime = 10;
const byte trig = 8;

void setup() {

  //Setup LED Pins
  pinMode(LR_0, OUTPUT);
  pinMode(LR_1, OUTPUT);
  pinMode(LR_2, OUTPUT);
  pinMode(LR_3, OUTPUT);
  pinMode(LC_0, OUTPUT);
  pinMode(LC_1, OUTPUT);
  pinMode(LC_2, OUTPUT);

  digitalWrite(LR_0, HIGH);
  digitalWrite(LR_1, HIGH);
  digitalWrite(LR_2, HIGH);
  digitalWrite(LR_3, HIGH);
  digitalWrite(LC_0, LOW);
  digitalWrite(LC_1, LOW);
  digitalWrite(LC_2, LOW);

  //Setup Button Pins
  pinMode(BC_0, OUTPUT);
  pinMode(BC_1, OUTPUT);
  pinMode(BC_2, OUTPUT);
  pinMode(BR_0, INPUT);
  pinMode(BR_1, INPUT);
  pinMode(BR_2, INPUT);
  pinMode(BR_3, INPUT);

  digitalWrite(BC_0, LOW);
  digitalWrite(BC_1, LOW);
  digitalWrite(BC_2, LOW);

  //Setup SPI Chip Select Pins
  pinMode(csADC, OUTPUT);
  pinMode(csDAC, OUTPUT);

  digitalWrite(csADC, HIGH);
  digitalWrite(csDAC, HIGH);
  SPI.begin();

  //Setup Trigger Pin
  pinMode(trig, OUTPUT);
  digitalWrite(trig, LOW);

  for (int k = 0; k <= 12; k++) {
    //notes[k] = EEPROM[k];
    notes[k] = 1;
  }
}

void loop() {

  readNoteButton(i); 

  if (notes[i] == 1) { 
    writeLED(i);
  } else {
    writeLED(0);
  }

  //Read ADC
  cvIn = adcRead(1);

  //Only Quantise if buttons are pressed.
  mode = 0;
  for (int j = 1; j <= 12; j++) {
    mode = mode + notes[j];
  }
  if (mode == 0) {
    cvOut = cvIn >> 1;<commit_msg>Update GMSN_Quantiser_v2.2.ino<commit_after>/*
  Test Code for the Pure Quantiser LEDs.

  LEDs should light in the following in order from top to bottom, for 1/2sec each
*/

#include "SPI.h"
#include <EEPROM.h>

//Setup LED Pin Varibles
const byte LR_0 = A3;
const byte LR_1 = A4;
const byte LR_2 = A5;
const byte LR_3 = 7;
const byte LC_0 = A0;
const byte LC_1 = A1;
const byte LC_2 = A2;

//Setup Button Pin Variable
const byte BC_0 = 2;
const byte BC_1 = 1;
const byte BC_2 = 0;
const byte BR_0 = 3;
const byte BR_1 = 4;
const byte BR_2 = 5;
const byte BR_3 = 6;

//Setup variable for the buttons, LEDs and temperament
int note;
int notes[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

int equalTempered[13] = {0, 68, 136, 205, 273, 341, 409, 478, 546, 614, 682, 751, 819};


//Setup program control variables
int mode = 0;
int i = 1;

//Setup switch debounce variables
unsigned long lastDebounceTime = 0;
unsigned long debounceDelay = 500;
int buttonState;
int lastButtonState[13] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

//Setup SPI Bus Pin Variables
const byte csADC = 9;
const byte csDAC = 10;

//Setup CV and Trigger Pin Variables
int cvIn;
int cvOut;
int lastCvOut;
int lastCvChange;
int triggerOnTime = 10;
const byte trig = 8;

void setup() {

  //Setup LED Pins
  pinMode(LR_0, OUTPUT);
  pinMode(LR_1, OUTPUT);
  pinMode(LR_2, OUTPUT);
  pinMode(LR_3, OUTPUT);
  pinMode(LC_0, OUTPUT);
  pinMode(LC_1, OUTPUT);
  pinMode(LC_2, OUTPUT);

  digitalWrite(LR_0, HIGH);
  digitalWrite(LR_1, HIGH);
  digitalWrite(LR_2, HIGH);
  digitalWrite(LR_3, HIGH);
  digitalWrite(LC_0, LOW);
  digitalWrite(LC_1, LOW);
  digitalWrite(LC_2, LOW);

  //Setup Button Pins
  pinMode(BC_0, OUTPUT);
  pinMode(BC_1, OUTPUT);
  pinMode(BC_2, OUTPUT);
  pinMode(BR_0, INPUT);
  pinMode(BR_1, INPUT);
  pinMode(BR_2, INPUT);
  pinMode(BR_3, INPUT);

  digitalWrite(BC_0, LOW);
  digitalWrite(BC_1, LOW);
  digitalWrite(BC_2, LOW);

  //Setup SPI Chip Select Pins
  pinMode(csADC, OUTPUT);
  pinMode(csDAC, OUTPUT);

  digitalWrite(csADC, HIGH);
  digitalWrite(csDAC, HIGH);
  SPI.begin();

  //Setup Trigger Pin
  pinMode(trig, OUTPUT);
  digitalWrite(trig, LOW);

  for (int k = 0; k <= 12; k++) {
    notes[k] = EEPROM[k];
    //notes[k] = 1;
  }
}

void loop() {

  readNoteButton(i); 

  if (notes[i] == 1) { 
    writeLED(i);
  } else {
    writeLED(0);
  }

  //Read ADC
  cvIn = adcRead(1);

  //Only Quantise if buttons are pressed.
  mode = 0;
  for (int j = 1; j <= 12; j++) {
    mode = mode + notes[j];
  }
  if (mode == 0) {
    cvOut = cvIn >> 1;
{'fraction_non_alphanumeric': 0.13985464545275977, 'fraction_numerical': 0.05774896876841485, 'mean_word_length': 3.466666666666667, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '982850', 'n_tokens_mistral': 2348, 'n_tokens_neox': 2062, 'n_words': 660}