add week 9

This commit is contained in:
2023-06-13 18:48:18 +09:00
parent ea1dce3f3b
commit a06880b413
50 changed files with 388 additions and 2 deletions

View File

@ -0,0 +1,17 @@
const int button_pin = 2;
const int sound_pin = 9;
void setup() {
pinMode(button_pin, INPUT);
//tone()を使うときは3,11以外
pinMode(sound_pin, OUTPUT);
}
void loop() {
if (digitalRead(2) == HIGH) {
tone(sound_pin, 1000);
} else {
noTone(sound_pin);
}
delay(20);
}