<commit_before>// Attiny85 buzzer
// Worked for me at 8mhz
// Attiny Pin 4 >> 220 Ohm resistor >> Piezo buzzer >> GND
// 
// Largely copied from http://www.technoblogy.com/show?20MO

// Can be 1 or 4
const int Output = 4;   

// Cater for 16MHz, 8MHz, or 1MHz clock:
const int Clock = ((F_CPU/1000000UL) == 16) ? 4 : ((F_CPU/1000000UL) == 8) ? 3 : 0;
const uint8_t scale[] PROGMEM = {239,226,213,201,190,179,169,160,151,142,134,127};

void setup() {

}

void loop() {
  for (int n=0; n<=12; n++) {
    note(n, 4);
    if (n!=4 && n!=11) n++;
    delay(100);
  }
  note(0, 0);
  delay(100);
}

void note (int n, int octave) {
  int prescaler = 8 + Clock - (octave + n/12);
  if (prescaler<1 || prescaler>15 || octave==0) prescaler = 0;<commit_msg>speaker support<commit_after>// Attiny85 buzzer
// Worked for me at 8mhz
// Attiny Pin 4 >> 220 Ohm resistor >> Piezo buzzer or 8 Ohm / 1 Watt speaker >> GND
// Largely copied from http://www.technoblogy.com/show?20MO

// Can be 1 or 4
const int Output = 4;   

// Cater for 16MHz, 8MHz, or 1MHz clock:
const int Clock = ((F_CPU/1000000UL) == 16) ? 4 : ((F_CPU/1000000UL) == 8) ? 3 : 0;
const uint8_t scale[] PROGMEM = {239,226,213,201,190,179,169,160,151,142,134,127};

void setup() {

}

void loop() {
  for (int n=0; n<=12; n++) {
    note(n, 4);
    if (n!=4 && n!=11) n++;
    delay(100);
  }
  note(0, 0);
  delay(100);
}

void note (int n, int octave) {
  int prescaler = 8 + Clock - (octave + n/12);
  if (prescaler<1 || prescaler>15 || octave==0) prescaler = 0;
{'fraction_non_alphanumeric': 0.18403693931398418, 'fraction_numerical': 0.1279683377308707, 'mean_word_length': 3.1906077348066297, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7465531', 'n_tokens_mistral': 787, 'n_tokens_neox': 631, 'n_words': 184}