Because I2C uses open-drain lines, both the SDA and SCL lines (typically 4.7kΩ to 10kΩ) connected to the VCC power rail. Most commercial sensor breakout boards (like those from Adafruit or SparkFun) have these pull-up resistors pre-installed on the circuit board. Wire.h Pin Mapping Across Popular Arduino Boards
if(error == 0) Serial.print("I2C device found at address 0x"); if(address < 16) Serial.print("0"); Serial.println(address, HEX); nDevices++;
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire download wire.h library for arduino
#include <Wire.h>
: The library files are typically located within the hardware folder of your Arduino installation (e.g., Because I2C uses open-drain lines, both the SDA
void loop() Wire.beginTransmission(0x12); // Address of the I2C device Wire.write("Hello, world!"); // Send data to the device Wire.endTransmission(); delay(1000);
Inside that folder, you’ll find:
The physical locations of the SDA and SCL pins vary depending on the microcontroller architecture you are using. Arduino Board Operating Voltage Arduino Mega 2560 Arduino Leonardo / Micro Arduino UNO R4 Minima/WiFi Dedicated SDA Dedicated SCL ESP8266 (e.g., NodeMCU) GPIO4 (D2) GPIO5 (D1) 3.3V (Check logic levels!) ESP32 3.3V (Check logic levels!) Essential Wire.h Library Functions
Enjoyed this guide? Share it with a fellow maker who’s still looking for a Wire.zip file. Arduino Board Operating Voltage Arduino Mega 2560 Arduino
Are you encountering a specific ?
The Wire.h library is included by default with the Arduino IDE. You do not need to download or install it separately.