0Pricing
Arduino & IoT Academy · レッスン

1つのバスで複数のデバイスを動かす

LCDとセンサーでI2Cを共有します。

「1つのバスで複数のデバイスを動かす」はCoddyKit上の無料Arduino & IoT Academyレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはArduino & IoT Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Arduino & IoT Academyコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Share the Same Wires

The real power of I2C is sharing. An LCD and a sensor can sit on the same two wires at once. 🔗

Addresses Keep Order

Because every device has a unique address, the master talks to each one in turn without any of them getting confused.

Wire Them in Parallel

Connect every device's SDA to SDA and SCL to SCL. They all sit in parallel on the same shared bus lines.

One Set of Pull-Ups

The whole bus needs only one pair of pull-up resistors, not one per device. Many breakouts already include theirs.

Beware Address Clashes

Two devices sharing one address will conflict. Run your scanner first to spot duplicates before wiring everything together.

Change an Address

Many boards let you change the address with a solder jumper or pin. That frees you to run two identical sensors at once.

One Wire.begin for All

You call Wire.begin() just once. Every library on the bus shares that single connection no matter how many devices you add.

void setup() {
  Wire.begin();
}

Each Library Knows Its Address

You give each library the device's address when you create it, so calls route to the right chip automatically.

LiquidCrystal_I2C lcd(0x27, 16, 2);

Talk to Each in the Loop

In loop, read the sensor, then update the LCD. The bus handles one conversation at a time, so order is fine.

float t = sensor.readTemp();
lcd.print(t);

Keep Wires Short

Long shared wires add noise and can break the bus. Keep I2C runs short and tidy for reliable communication.

Scale Up Your Projects

With this skill you can grow a project by simply adding more I2C modules, all on the same two trusty wires. 🚀

Quick Check

What happens if two I2C devices share the same address?

Recap

You can now wire multiple I2C devices in parallel, avoid address clashes, and address each one to build bigger projects. ✅

よくある質問

「1つのバスで複数のデバイスを動かす」レッスンは無料ですか?

はい。「1つのバスで複数のデバイスを動かす」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Arduino & IoT Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Arduino & IoT Academyコースには全4レッスンが含まれています。

「1つのバスで複数のデバイスを動かす」で何を学びますか?

LCDとセンサーでI2Cを共有します。 ブラウザで直接実行するハンズオンコードでArduino & IoT Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Arduino & IoT Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのArduino & IoT Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。

「1つのバスで複数のデバイスを動かす」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このArduino & IoT Academyレッスンでコードを書いて実行できますか?

はい。すべてのArduino & IoT Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. I2Cが2本の線で通信する仕組み
  2. I2Cアドレスをスキャンする
  3. SPIが高速にデータを送る仕組み
  4. 1つのバスで複数のデバイスを動かす
← Arduino & IoT Academyに戻る