Ответ:
const int piezoPin = 9;
int frequency = 1000;
int duration = 100;
void setup() {
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
}
void loop() {
if (digitalRead(2) == LOW) {
tone(piezoPin, frequency, duration);
if (digitalRead(3) == LOW) {
frequency += 100;
if (digitalRead(4) == LOW) {
frequency -= 100;
if (digitalRead(5) == LOW) {
duration += 50;
if (digitalRead(6) == LOW) {
duration -= 50;
delay(50);
Объяснение:
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
const int piezoPin = 9;
int frequency = 1000;
int duration = 100;
void setup() {
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
}
void loop() {
if (digitalRead(2) == LOW) {
tone(piezoPin, frequency, duration);
}
if (digitalRead(3) == LOW) {
frequency += 100;
}
if (digitalRead(4) == LOW) {
frequency -= 100;
}
if (digitalRead(5) == LOW) {
duration += 50;
}
if (digitalRead(6) == LOW) {
duration -= 50;
}
delay(50);
}
Объяснение: