arduino:m5stickc:02.エルチカ

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
arduino:m5stick:02.エルチカ [2020/08/08 10:12] babaarduino:m5stickc:02.エルチカ [2020/09/07 09:28] (現在) baba
行 50: 行 50:
  
 {{ :arduino:m5stick:スクリーンショット_2020-08-08_10.10.53.png |}} {{ :arduino:m5stick:スクリーンショット_2020-08-08_10.10.53.png |}}
 +
 +
 +===== ボタンを押したときだけ光るLED =====
 +では最後にボタン(G37)を押したときだけLEDが発光するプログラムを作成してみます.
 +<html>
 +<div style="position: relative; padding-bottom: 62.5%; height: 0;"><iframe src="https://www.loom.com/embed/36a474cffab14c05b29836ca3454ce33" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe></div>
 +</html>
 +<code>
 +#include <M5StickC.h>
 +
 +void setup() {
 +  // put your setup code here, to run once:
 +  pinMode(G0, OUTPUT);
 +  pinMode(G37, INPUT);
 +}
 +
 +void loop() {
 +  // put your main code here, to run repeatedly:
 +  if( digitalRead(G37) == LOW ){
 +    digitalWrite(G0, HIGH);
 +  }
 +  else{
 +    digitalWrite(G0, LOW);
 +  }
 +}
 +</code>
 +
 +----
 +
 +{{indexmenu>:arduino:m5stickc#1|js#indextheme navbar}}
  
  • /home/users/2/lolipop.jp-4404d470cd64c603/web/ws/data/attic/arduino/m5stickc/02.エルチカ.1596849138.txt.gz
  • 最終更新: 2020/08/08 10:12
  • by baba