0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

M5StampS3、2ボタンで遊ぶ(マルツ(秋葉原)で買った)

Posted at

参考

x 過去ログを見よ!!!
x 3.1.0

o_coq746.jpg

o_coq747.jpg

o_coq748.jpg




//2button_test1_M5StampS3_1


//インクルド
#include <Arduino.h>


//初期化
void setup() {
  // put your setup code here, to run once:

  //GPIOの初期化
  pinMode(21, OUTPUT);
  pinMode(13, INPUT);
  pinMode(15, INPUT);

}//setup


//メインループ
void loop() {
  // put your main code here, to run repeatedly:

  int a = digitalRead(15); //ボタンの読み込み
  int b = digitalRead(13); //ボタンの読み込み

  if ( a != 0 && b == 0 ) {

    neopixelWrite(21, 64, 0, 0);

  } else if ( a == 0 && b != 0 ) {

    neopixelWrite(21, 0, 0, 64);

  } else if ( a == 0 && b == 0 ) {

    neopixelWrite(21, 64, 0, 64);

  } else {

    neopixelWrite(21, 0, 0, 0);

  } //endif

  delay(10); // 1 / 100 秒待つ

}//loop




0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?