Rangkaian seperti gambar dibawah ini.
untuk library bisa download di link dibawah ini:
https://drive.google.com/file/d/1AxX0iL35HqeRJPeiweYHPBdK9Crg7Asg/view?usp=sharing
Sketch program bisa didownload di sini
https://drive.google.com/file/d/1FqIe2zt-8dF5FC0k_2NGP2BIIWYgMMIq/view?usp=sharing
kode program :
https://drive.google.com/file/d/1FqIe2zt-8dF5FC0k_2NGP2BIIWYgMMIq/view?usp=sharing
kode program :
/http://elektronikaprogram.blogspot.com
//http://duniamikrokontroler.blogspot.com
//tutorial mencari alamat i2c
#include <Wire.h>; //memasukkan library
void setup(){
Wire.begin();
Serial.begin(9600); //menampilkan serial monitor
while (!Serial);
Serial.println("\nI2C Scanner");
}
void loop(){
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ ){
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0){
Serial.print("ditemukan Perangkat i2C pada alamat 0x");
if (address<16)
Serial.print("0");
Serial.print(address,HEX);
Serial.println(" !");
nDevices++;
}
else if (error==4){
Serial.print("tidak ditemukan alamat 0x");
if (address<16)
Serial.print("0");
Serial.println(address,HEX);
}
}
if (nDevices == 0)
Serial.println("Tidak Ditemukan Alamat i2c\n");
else
Serial.println("selesai\n");
delay(5000);
}
//http://duniamikrokontroler.blogspot.com
//tutorial mencari alamat i2c
#include <Wire.h>; //memasukkan library
void setup(){
Wire.begin();
Serial.begin(9600); //menampilkan serial monitor
while (!Serial);
Serial.println("\nI2C Scanner");
}
void loop(){
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ ){
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0){
Serial.print("ditemukan Perangkat i2C pada alamat 0x");
if (address<16)
Serial.print("0");
Serial.print(address,HEX);
Serial.println(" !");
nDevices++;
}
else if (error==4){
Serial.print("tidak ditemukan alamat 0x");
if (address<16)
Serial.print("0");
Serial.println(address,HEX);
}
}
if (nDevices == 0)
Serial.println("Tidak Ditemukan Alamat i2c\n");
else
Serial.println("selesai\n");
delay(5000);
}
setelah kalian upload sketch pada arduino selanjutnya kalian buka menu serial monitor. alamat modul i2c akan muncul dengan menampilkan kode di serial monitor.