Arduino UNO R4でLチカ、、tone()で。 [Arduino]
もっと簡単にLチカできる方法!
tone関数を使えば実質1行だけ。
tone() - Arduino Reference
https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/
・「It is not possible to generate tones lower than 31Hz.」とあったが、UNO R4では1Hzもいけた。
・周波数は整数型(unsigned int)なので1Hzよりゆっくりにはできない。
・duty比を指定できない。
Blink LED with tone function.
<tone()関係プログラムの在処>
%LocalAppData%\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\Tone.cpp
tone関数を使えば実質1行だけ。
tone() - Arduino Reference
https://www.arduino.cc/reference/en/language/functions/advanced-io/tone/
・「It is not possible to generate tones lower than 31Hz.」とあったが、UNO R4では1Hzもいけた。
・周波数は整数型(unsigned int)なので1Hzよりゆっくりにはできない。
・duty比を指定できない。
Blink LED with tone function.
void setup() {
tone(LED_BUILTIN, 1); // 1Hz : toggle ON and OFF every 500ms
}
void loop() {
}
<tone()関係プログラムの在処>
%LocalAppData%\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\Tone.cpp
2023-08-27 11:58
nice!(0)
コメント(0)
コメント 0