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?

More than 1 year has passed since last update.

STM32G071でI2CのIDのスキャニング

Posted at

目的
OLEDのアドレスをさがす。
たぶん3Cだから3Cが表示されたら当たり

o_con781.jpg




//i2c_scanner_071_1

#include <Arduino.h>
#include <Wire.h>

//初期化
void setup() {

  Wire.begin();

  Serial.begin(9600);

  char hex1[] = {
    '0', '1', '2', '3', '4', '5', '6', '7',
    '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
  };

  for (int ii = 1;  ii < 127; ii++ )
  {

    Wire.beginTransmission(ii);

    if (Wire.endTransmission() == 0)
    {
      Serial.print( hex1[  (ii >> 4) ]  );
      Serial.print( hex1[  (ii & 15) ]  );
      Serial.print(",");
    }//if

  }//for

}//setup

//無限ループ
void loop() {
}//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?