<commit_before>#include "FreqCount.h"
#define LED_PIN_1 9
#define LED_PIN_2 11

unsigned long freqCount;
#define LOW_START 3000
#define HIGH_START  4000
bool robotOn = false;
bool checkingMicrophone = true;
bool hearingStartSound = false;

long getFreqCount() {
  return freqCount;
}

void checkMicrophone() {
  // Measure sound:
  if (FreqCount.available()) {
    freqCount = FreqCount.read();
    Serial.println(String(getFreqCount()));
  } else {
    freqCount = 0;
  }

  // If the sound frequency is within start sound bounds, turn on robot:
  if (freqCount > LOW_START && freqCount < HIGH_START) {
    robotOn = true; // Set the robot to on
    hearingStartSound = true;
  } else {
    hearingStartSound = false;
    if (robotOn) {
      checkingMicrophone = false;
      FreqCount.end();
    }
  }
}

void setup() {
  // put your setup code here, to run once:
  FreqCount.begin(1000);
  Serial.begin(9600);
  pinMode(LED_PIN_1, OUTPUT);
  pinMode(LED_PIN_2, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (checkingMicrophone) {   //Robot doesn't start until it hears the start frequency
    checkMicrophone();
  }
  digitalWrite(LED_PIN_1, HIGH);
  digitalWrite(LED_PIN_2, HIGH);
  delay(500);
  digitalWrite(LED_PIN_1, LOW);
  digitalWrite(LED_PIN_2, LOW);
  delay(500);
}<commit_msg>Tested mic and made some adjustments<commit_after>#include "FreqCount.h"
#define LED_PIN_1 30
#define LED_PIN_2 31

unsigned long freqCount;
#define LOW_START 3000
#define HIGH_START  4000

long getFreqCount() {
  return freqCount;
}

void checkMicrophone() {
  //bool robotOn = false;
  //bool checkingMicrophone = true;
  //bool hearingStartSound = false;

  // Measure sound:
  while (true) {
    if (FreqCount.available()) {
      freqCount = FreqCount.read();
      Serial.println(String(getFreqCount()));
    } else {
      freqCount = 0;
    }

    // If the sound frequency is within start sound bounds, turn on robot:
    if (LOW_START < freqCount && freqCount < HIGH_START) {
      //robotOn = true; // Set the robot to on
      break;
    //   hearingStartSound = true;
    // } else {
    //   hearingStartSound = false;
    //   if (robotOn) {
    //     checkingMicrophone = false;
    //     FreqCount.end();
    //   }
    }
  }
}

void setup() {
  // put your setup code here, to run once:
  FreqCount.begin(1000);
  Serial.begin(9600);
  pinMode(LED_PIN_1, OUTPUT);
  pinMode(LED_PIN_2, OUTPUT);

  // Hold robot in setup state until microphone is found
  checkMicrophone();
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(LED_PIN_1, HIGH);
  digitalWrite(LED_PIN_2, HIGH);
  delay(500);
  digitalWrite(LED_PIN_1, LOW);
  digitalWrite(LED_PIN_2, LOW);
  delay(500);
}
{'fraction_non_alphanumeric': 0.11738971928545389, 'fraction_numerical': 0.025154939846882975, 'mean_word_length': 3.241112828438949, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7514554', 'n_tokens_mistral': 1012, 'n_tokens_neox': 946, 'n_words': 254}