Показаны различия между двумя версиями страницы.
| Следующая версия | Предыдущая версия | ||
| products:laboratory_iot_c:exp24 [2024/12/03 20:33] – создано labuser30 | products:laboratory_iot_c:exp24 [2024/12/03 21:13] (текущий) – [Программный код эксперимента] labuser30 | ||
|---|---|---|---|
| Строка 33: | Строка 33: | ||
| Sound melody[42] = { | Sound melody[42] = { | ||
| - | {c, 8}, {a, 8}, {a, 8}, {g, 8}, {a, 8}, {f, 8}, {c, 8}, {c, 8}, {c, 8}, {a, 8}, | + | {c, 8}, {a, 8}, {a, 8}, {g, 8}, {a, 8}, {f, 8}, {c, 8}, {c, 8}, |
| - | | + | |
| - | | + | |
| - | | + | |
| + | | ||
| {a, 8}, {f, 3} | {a, 8}, {f, 3} | ||
| }; | }; | ||
| Строка 49: | Строка 50: | ||
| analogWrite(SPEAKER_PIN, | analogWrite(SPEAKER_PIN, | ||
| analogWriteFreq(tones[melody[i].note]); | analogWriteFreq(tones[melody[i].note]); | ||
| - | delay(tempo/ | + | delay(tempo / melody[i].length); |
| analogWrite(SPEAKER_PIN, | analogWrite(SPEAKER_PIN, | ||
| - | delay(tempo/ | + | delay(tempo / melody[i].length / 4); |
| } | } | ||
| } | } | ||