差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
| arduino:m5stickc:02.エルチカ [2020/08/13 08:59] – ↷ arduino:m5stick:02.エルチカ から arduino:m5stickc:02.エルチカ へページを移動しました。 baba | arduino:m5stickc:02.エルチカ [2020/09/07 09:28] (現在) – baba | ||
|---|---|---|---|
| 行 50: | 行 50: | ||
| {{ : | {{ : | ||
| + | |||
| + | |||
| + | ===== ボタンを押したときだけ光るLED ===== | ||
| + | では最後にボタン(G37)を押したときだけLEDが発光するプログラムを作成してみます. | ||
| + | < | ||
| + | <div style=" | ||
| + | </ | ||
| + | < | ||
| + | #include < | ||
| + | |||
| + | void setup() { | ||
| + | // put your setup code here, to run once: | ||
| + | pinMode(G0, OUTPUT); | ||
| + | pinMode(G37, | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | // put your main code here, to run repeatedly: | ||
| + | if( digitalRead(G37) == LOW ){ | ||
| + | digitalWrite(G0, | ||
| + | } | ||
| + | else{ | ||
| + | digitalWrite(G0, | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | {{indexmenu>: | ||