Генератор для катушки "Мишина"

Тестирование зуммера, ESP32S3 /CORE 3.0.4

/*
Bit resolution | Min Frequency [Hz] | Max Frequency [Hz]
             1 |              19532 |           20039138
             2 |               9766 |           10019569
             3 |               4883 |            5009784
             4 |               2442 |            2504892
             5 |               1221 |            1252446
             6 |                611 |             626223
             7 |                306 |             313111
             8 |                153 |             156555
             9 |                 77 |              78277
            10 |                 39 |              39138
            11 |                 20 |              19569
            12 |                 10 |               9784
            13 |                  5 |               4892
            14 |                  3 |               2446
 */

#define soundpin 38

void setup() {

  Serial.begin(115200);
  delay(1000);
  Serial.println("Buzzer Start");

  //ledcAttach(soundpin,NOTE_A,7); //ledcAttach(uint8_tpin,uint32_tfreq,uint8_tresolution); for ESP core V3
  ledcAttachChannel(soundpin,65535,8, 1);
  delay(250); 
  ledcWriteNote(soundpin,NOTE_C, 4);    // PIN, frequency, octave for ESP core V3
  delay(250);
  ledcWriteNote(soundpin,NOTE_D, 4);    // PIN, frequency, octave for ESP core V3
  delay(250);
  ledcWriteNote(soundpin,NOTE_F, 4);    // PIN, frequency, octave for ESP core V3
  delay(250);
  ledcWriteNote(soundpin,NOTE_C, 4);    // PIN, frequency, octave for ESP core V3
  delay(250);
  ledcWriteNote(soundpin,NOTE_D, 4);    // PIN, frequency, octave for ESP core V3
  delay(500);
  ledcWriteNote(soundpin,NOTE_C, 4);    // PIN, frequency, octave for ESP core V3
  delay(500);

  ledcWrite(soundpin,0); // No sound 
  ledcDetach(soundpin);  
  Serial.println("Buzzer Stop");
}

void loop() {

}
1 лайк