Change I2C Address SRF10

Change I2C Address of SRF10

AddressLong FlashShort flashes
DecimalHex
224E010
226E211
228E412
230E613
232E814
234EA15
236EC16
238EE17
240F018
242F219
244F4110
246F6111
248F8112
250FA113
252FC114
254FE115
Address Table
For SRF10 can set ID for I2C up to 16 address as a table upper, So this post is about how to set ID for every SRF10. First, you need to have an only one SRF10 connect to I2C bus then use to the following code.
Change Address Code:
#include <Wire.h>

#define ADDRESS byte(0x72) //defines address
#define NEW_ADDRESS byte(0xEC) //defines address
#define CMD byte(0x00)

void setup() {
  // put your setup code here, to run once:
  Wire.begin(); //conects I2C
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(5000);
  Serial.println("Begin");
  Wire.beginTransmission(ADDRESS);
  Wire.write(CMD);
  Wire.write(byte(0xA0));
  Wire.endTransmission();
  //delay(100);
  Wire.beginTransmission(ADDRESS);
  Wire.write(CMD);
  Wire.write(byte(0xAA));
  Wire.endTransmission();
  //delay(100);
  Wire.beginTransmission(ADDRESS);
  Wire.write(CMD);
  Wire.write(byte(0xA5));
  Wire.endTransmission();
  //delay(100);
  Wire.beginTransmission(ADDRESS);
  Wire.write(CMD);
  Wire.write(NEW_ADDRESS);
  Wire.endTransmission();
  Serial.println("END");
  delay(5000);
}
This code will change ID from 0xE4 to 0xEC you just change address and new address according to the address table.
Reference: SRF10 Document

Comments

Popular posts from this blog

Sharp 2Y0A21 F 03

CMPS03 Compass Module