1
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?

M5NanoC6、秋葉マルツで買った2ボタンで遊ぶ(理系フリマ1207展示予定)

Last updated at Posted at 2024-11-28

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

o_coq654.jpg

o_coq655.jpg

o_coq656.jpg

o_coq657.jpg



//2button_test1_M5NanoC6_1


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


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

  //GPIOの初期化
  pinMode(19, OUTPUT);
  digitalWrite(19, HIGH);
  pinMode(20, OUTPUT);
  pinMode(1, INPUT);
  pinMode(2, INPUT);

}//setup


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

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

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

    neopixelWrite(20, 64, 0, 0);

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

    neopixelWrite(20, 0, 0, 64);

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

    neopixelWrite(20, 64, 0, 64);

  } else {

    neopixelWrite(20, 0, 0, 0);

  } //endif

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

}//loop


1
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
1
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?