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?

[I2C]STM32C011F4P6、1ビット拡張エキスパンダー(I2Cスレーブ拡張I.O) MSXマートあるよ

Last updated at Posted at 2025-09-15

参考

いろいろ注意

  • 過去ログを見よ!!!
  • U(S)ART support:"Disabled(no Serial support)"

結果

Screenshot from 2025-09-16 07-53-57.png

Screenshot from 2025-09-16 07-54-17.png

プログラム




//I2C_Slave_1bit_ext_out_C0116_1


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


//定義
#define DD PB6  // OUTPUT pin x (ダイレクトドライブ)


//初期化
void setup() {

  //I2Cの初期化
  Wire.begin(0x80 >> 1);         // I2Cスレーブアドレスの設定
  Wire.onReceive(receiveEvent);  // データが来ると呼ばれる関数

  //GPIOの初期化
  pinMode(DD, OUTPUT);  // sets the LED pin as output

}  //setup


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

  delay(3);  //ダミー

}  //loop


//レシーブイベント(受信)
void receiveEvent(int howMany) {

  int x = Wire.read();  // I2C受信データの読み込み

  digitalWrite(DD, (x & 0x01));  // 1bit出力

}  //receiveEvent




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?