Const NewAddress = 224 ' CHANGE THIS NUMBER FOR THE REQUIRED ADDRESS ' See table below. ' This program can be used to set the I2C address of the SRF08 Sonar Module ' Valid address are 0xE0 to 0xFE ' The following table shows the decimal number to set the .node to, for any ' desired hex address. ' E0 -> 224 ' E2 -> 226 ' E4 -> 228 ' E6 -> 230 ' E8 -> 232 ' EA -> 234 ' EC -> 236 ' EE -> 238 ' F0 -> 240 ' F2 -> 242 ' F4 -> 244 ' F6 -> 246 ' F8 -> 248 ' FA -> 250 ' FC -> 252 ' FE -> 254 ' Important! You must only have one SRF08 connected up when you set the I2C ' address. You don't want two sonars at the same address do you? ' You might want to write the address on the sonar after setting it, so ' that you know which is which afterwards. ' ' When you run this software, it will change the I2C address and then use ' that address to continuously "ping" the sonar. You should see the LED ' giving rapid, brief flashes. Dim Srf08 As New oI2C 'Create the SRF08 object Dim Ver as new oByte Sub main() SRF08.Node = 0 ' Use general broadcast address, because we ' don't know where SRF08 currently is. SRF08.Mode = cv10bit ' I2C mode is 10-Bit Addressing. SRF08.NoInc = 1 ' Don't increment SRF08.Width = cv8bit ' 1 byte wide transfer SRF08.Location = 0 ' Command register SRF08 = 160 ' Hex A0 SRF08 = 170 ' Hex AA SRF08 = 165 ' Hex A5 SRF08 = NewAddress ' Selected Address, as defined above ' Because of the way the OOPIC works, it requires addresses to be right ' shifted by 1. So address 0xE0 is 112, which is the Decimal of ' Hex address 0xE0 shifted right by 1 (or divded by 2 - same thing) SRF08.Node = NewAddress/2 Do SRF08 = 81 ' One of the Ranging Commands Do Ver = SRF08 Loop While Ver=255 ' Wait for ranging to complete Loop ' Keep pinging forever End Sub