A place for all the arduino code I write.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
710 B

/*
*
* Search for an EEPROM.
* This sketch iterate the eight possible I2C addresses and
* checks if an EEPROM is found.
*
* Written by Christian Paul, 2014-11-24
*
*
*/
// include libraries
#include <Wire.h>
// setup
void setup() {
Serial.begin(9600);
Serial.println("AT24CX search");
Serial.println("-------------------------");
Wire.begin();
int i2c = 0x50;
for (int i=0; i<8; i++) {
Serial.print("Search at [");
Serial.print(i2c, HEX);
Serial.print("]: ");
Wire.beginTransmission(i2c);
int result = Wire.endTransmission();
if (result==0)
Serial.println("FOUND!");
else
Serial.println("not found");
i2c++;
}
}
// main loop
void loop() {}