#define SCL_PIN 5 //Default SDA is Pin5 PORTC for the UNO -- you can set this to any tristate pin#define SCL_PORT PORTC #define SDA_PIN 4 //Default SCL is Pin4 PORTC for the UNO -- you can set this to any tristate pin#define SDA_PORT PORTC
Polling addresses...Couldn't start:2Couldn't start:4Couldn't start:6Couldn't start:8Couldn't start:10Couldn't start:12Couldn't start:14Couldn't start:16Couldn't start:18Couldn't start:20Couldn't start:22Couldn't start:24Couldn't start:26Couldn't start:28Couldn't start:30Couldn't start:32Couldn't start:34Couldn't start:36Couldn't start:38Couldn't start:40Couldn't start:42Couldn't start:44Couldn't start:46Couldn't start:48Couldn't start:50Couldn't start:52Couldn't start:54Couldn't start:56Couldn't start:58Couldn't start:60Couldn't start:62Couldn't start:64Couldn't start:66Couldn't start:68Couldn't start:70Couldn't start:72Couldn't start:74Couldn't start:76Couldn't start:78Couldn't start:80Couldn't start:82Couldn't start:84Couldn't start:86Couldn't start:88Couldn't start:90Couldn't start:92Couldn't start:94Couldn't start:96Couldn't start:98Couldn't start:100Couldn't start:102Couldn't start:104Couldn't start:106Couldn't start:108Couldn't start:110Couldn't start:112Couldn't start:114Couldn't start:116Couldn't start:118Couldn't start:120Couldn't start:122Couldn't start:124Couldn't start:126Couldn't start:128Couldn't start:130Couldn't start:132Couldn't start:134Couldn't start:136Couldn't start:138Couldn't start:140Couldn't start:142Couldn't start:144Couldn't start:146Couldn't start:148Couldn't start:150Couldn't start:152Couldn't start:154Couldn't start:156Couldn't start:158Couldn't start:160Couldn't start:162Couldn't start:164Couldn't start:166Couldn't start:168Couldn't start:170Couldn't start:172Couldn't start:174Couldn't start:176Couldn't start:178Couldn't start:180Couldn't start:182Couldn't start:184Couldn't start:186Couldn't start:188Couldn't start:190Couldn't start:192Couldn't start:194Couldn't start:196Couldn't start:198Couldn't start:200Couldn't start:202Couldn't start:204Couldn't start:206Couldn't start:208Couldn't start:210Couldn't start:212Couldn't start:214Couldn't start:216Couldn't start:218Couldn't start:220Couldn't start:222Couldn't start:224Couldn't start:226Couldn't start:228Couldn't start:230Couldn't start:232Couldn't start:234Couldn't start:236Couldn't start:238Couldn't start:240Couldn't start:242Couldn't start:244Couldn't start:246Couldn't start:248Couldn't start:250Couldn't start:252Couldn't start:254Address polling complete.Take a reading at the default addressChange the sensor at the default address to 222Take a reading at the new addressChange the sensor back to the default address
Those aren't Arduino pin numbers; they are hardware pin numbers for PORTC, SCL and SDA on the Uno.The corresponding I2C pins are PORTD pin 0 (SCL) and PORTD pin 1 (SCA) on the 2560.
It's not a good idea to use any but the standard Wire library to support as many different i2C devices as you like. Why use a software I2C library if a hardware I2C connection is available on every Arduino? See the Wire library examples for scanning I2C devices and more. Add the specific parts of the MaxSonar library to your sketch.
The sensor has a really poor design, if it requires a special library for its crippled I2C interface. Be prepared for trouble with any other hardware, that needs attention while a communication with the sensor is going on.I'd use a sensor with a different interface. RS232 should be easier to use, then you can connect the sensor to one of the free Serial ports of the Mega (Serial1-3).
You can use any small Arduino (Mini...) for dealing with that sensor, a Mega is not required for that purpose. Then you can read the sensor and transfer the data alternately, without any possible trouble caused by the sensor library. The Pro Mini uses the same controller than the Uno, for other controllers you may have to adapt the pin numbers in the library as appropriate.