#define SPEAKER_PIN 7
const int dotDuration = 250;
const int dashDuration = 3 * dotDuration;
int notes[] = {
1318, 1318, 1318, 1046, 1318, 1568, 784,
1046, 784, 659, 880, 987, 932, 880, 784,
1318, 1568, 1750, 1396, 1568, 1318, 1046, 1174, 987,
1046, 784, 659, 880, 987, 932, 880,
784, 1318, 1568, 1750, 1396, 1568, 1318, 1046, 1174, 987,
1568, 1480, 1396, 1244, 1318, 830, 880, 1046, 880, 1046, 1174,
0, 1568, 1480, 1396, 1244, 1318, 2093, 2093, 2093,
1568, 1480, 1396, 1244, 1318, 830, 880, 1046, 880, 1046, 1174, 1244, 1174, 1046,
};
int times[] = {
150, 300, 150, 150, 300, 600, 600,
450, 150, 300, 300, 150, 150, 300, 210,
210, 150, 300, 150, 150, 300, 150, 150, 450,
450, 150, 300, 300, 150, 150, 300,
210, 210, 150, 300, 150, 150, 300, 150, 150, 450,
150, 150, 150, 300, 150, 150, 150, 150, 150, 150, 150,
0, 150, 150, 150, 300, 150, 300, 150, 600,
150, 150, 150, 300, 150, 150, 150, 150, 150, 150, 150, 300, 450, 600,
};
int delays[] = {
150, 300, 300, 150, 300, 600, 600,
450, 450, 450, 300, 300, 150, 300, 210,
210, 150, 300, 150, 300, 300, 150, 150, 450,
450, 450, 450, 300, 300, 150, 300,
210, 210, 150, 300, 150, 300, 300, 150, 150, 600,
150, 150, 150, 300, 300, 150, 150, 300, 150, 150, 150,
300, 150, 150, 150, 300, 300, 300, 150, 600,
150, 150, 150, 300, 300, 150, 150, 300, 150, 150, 450, 450, 450, 1200,
};
void setup() {
pinMode(SPEAKER_PIN, OUTPUT);
//Завдання №1
// char letter[] = {'.', '.', '.', '.'};
// for (int i = 0; i < sizeof(letter); i++) {
// if (letter[i] == '.') {
// tone(SPEAKER_PIN, 1000, dotDuration);
// delay(dotDuration);
// } else if (letter[i] == '-') {
// tone(SPEAKER_PIN, 1000, dashDuration);
// delay(dashDuration);
// }
// delay(dotDuration);
// }
//Завдання №3
// for (int i = 0; i < 75; i++){
// tone(SPEAKER_PIN, notes[i], times[i]);
// delay(delays[i]);
// }
// noTone(SPEAKER_PIN);
}
void loop() {
//Завдання №2
// for (int frequency = 100; frequency <= 2000; frequency += 10) {
// tone(SPEAKER_PIN, frequency);
// delay(10);
// }
// for (int frequency = 2000; frequency >= 100; frequency -= 10) {
// tone(SPEAKER_PIN, frequency);
// delay(10);
// }
// noTone(SPEAKER_PIN);
// delay(100);
}