Ard Wire Slave
DodaTech
1 min read
In this tutorial, you'll learn about Arduino I2C Slave Not Responding to Master. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.
The Problem
An Arduino configured as I2C slave does not respond to master requests.
Quick Fix
Wrong
Wire.begin(0x08); // No receive/request handlers registered
Master gets no response from the slave.
Right
#include <Wire.h>
int counter = 0;
void receiveEvent(int bytes) {
while (Wire.available()) {
char c = Wire.read();
Serial.print("Received: ");
Serial.println(c);
}
}
void requestEvent() {
Wire.write(counter++); // Send data to master
}
void setup() {
Serial.begin(9600);
Wire.begin(0x08); // Slave address 0x08
Wire.onReceive(receiveEvent);
Wire.onRequest(requestEvent);
Serial.println("I2C Slave at 0x08");
}
void loop() {
delay(100);
}
Slave at 0x08 responds to master reads/writes.
Prevention
Register Wire.onReceive() and Wire.onRequest() handlers before the I2C bus is used. The slave address must be unique on the bus (7-bit). Avoid address 0x00 (general call) and 0x78-0x7F (reserved). The slave cannot initiate communication — it only responds.
DodaTech engineers apply these same patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro for production IoT reliability.
FAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro