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?

STM32C0116-DKの十字キーをただの押しボタンして遊ぶ。

Posted at

結果

Screenshot from 2025-08-09 23-50-10.png

イメージ

o_coq938.jpg

プログラム



//ser_button_test1_c0116_1


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


//定義
//#define swdclk PA14 // ICの17pin
//#define swdio  PA13 // ICの16pin

// tx PA11[PA9]  ICの14pin
// rx PA12[PA10] ICの15pin

// ADC PA8 ICの13pin


//初期化
void setup() {

  //シリアルポートの初期化
  Serial.begin(9600);  // シリアル通信の速度を9600bpsにする。

  //GPIOの初期化
  pinMode(PA8, INPUT);  // button

}  //setup


//メインループ
void loop() {

  // ボタンの信号の読み込み
  int a = digitalRead(PA8);

  // ボタンの状態表示
  Serial.println(a);

  // 速すぎるからウェート
  delay(300);  // 0.3秒待つ

}  //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?