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.

Arduino UNOのI2Cの速度を変える

Last updated at Posted at 2022-05-10

目的
高速、低速のI2Cデバイスを使いたい

o_con417.jpg

o_con418.jpg

資料

プログラム



//I2C_0_UNO_1

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


//初期化
void setup() {

  //GPIOの初期化
  pinMode(LED_BUILTIN, OUTPUT);

  //i2cの初期化
  Wire.begin(); //UNO
  Wire.setClock(20000); //速度の変更

}//setup

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

  digitalWrite(LED_BUILTIN, 1); //LED ON debug

  //I2Cに送信
  Wire.beginTransmission(0x40);
  Wire.write('0');
  Wire.endTransmission();

  delay(500);//0.5秒待つ

  digitalWrite(LED_BUILTIN, 0); //LED OFF debug
  delay(500);//0.5秒待つ

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