[SOLVED] Cannot change SRF08 address

Hello, I currently am trying to work with several SRF08 sensors (on an Arduino Uno), but in order to do so, I obviously have to change their addresses... but, although I follow the data-sheet's instructions, I can't get to do that. Here is the code :

  Wire.begin();
  Wire.beginTransmission(Old_Address);
  Wire.send(0);
  Wire.send(0xA0);
  Wire.endTransmission();
   
  Wire.beginTransmission(Old_Address);
  Wire.send(0);
  Wire.send(0xAA);
  Wire.endTransmission();
  
  Wire.beginTransmission(Old_Address);
  Wire.send(0);
  Wire.send(0xA5);
  Wire.endTransmission();
  
  Wire.beginTransmission(Old_Address);
  Wire.send(0);
  Wire.send(New_Address);
  Wire.endTransmission();

I don't know what to do, I hope someone will be able to help. Thanks in advance.

it doesnt accept all addresses according to this: http://www.robot-electronics.co.uk/htm/srf08tech.shtml

For some reason it kinda worked. I tried to set an address to EE, and it was set to F7 instead... any idea why it occurred ? Though strictly speaking it doesn't matter to me as long as the address has changed, I'd like to know how this works. Maybe a bit is shifted.

oh - 0xF7 isnt a correct SRF08 address...

i guess, that is because of 7bit I2C addresses: 0xF7 = B11110111 0xEE = B11101110 0xEE (8bit address) --right-shift--> B01110111 = 0x77

so i guess ur new 7bit I2C address is 0x77 (which is equal 0xF7 modulo 128)... :)

Hm, addresses are supposed to range from E0 to FE though. And I know odd addresses aren't suppose to work, but they do. Thanks for the help.

nope there r 8bit I2C addresses and 7bit I2C addresses...

the arduino Wire library uses 7bit I2C addresses... http://arduino.cc/it/Reference/Wire

and the SRF08 address programming interface uses 8bit I2C addresses...

u can convert them like this: 1. 7bit to 8bit: shift left by 1bit 2. 8bit to 7bit: shift right by 1bit

8bit range: E0..FE (just even numbers) --> 7bit range: 70..7F (all numbers)

RIDDICK: nope there r 8bit I2C addresses and 7bit I2C addresses...

the arduino Wire library uses 7bit I2C addresses... http://arduino.cc/it/Reference/Wire

Thank you very much, I feel stupid for not noticing that.

i think it is normal that one (esp. a learner) misses some tiny detail... most important is, that u mentioned that something went wrong, and that u hunted for an explanation... in ur 2nd post u already had the right idea ("Maybe a bit is shifted.")...

Yep. Well now that I've understood that I'll have a good deal less problems working with them. Thanks again.