Created
January 8, 2020 10:36
-
-
Save deviceplususer/07ea6a9257bd1cca977f3be550ba5f73 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool volumeSwitchState = digitalRead(VOLUME_SWITCH);//音量つまみスイッチの値を取得 | |
if ( volumeSwitchState == 0 ) {//音量つまみスイッチがオンなら | |
tone(SPEAKER, frequency );//TOF距離センサーからの距離に応じた周波数の音を鳴らす | |
} else { | |
noTone(SPEAKER);//スイッチがオフなら音を止める | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment