The GreyGnome library has large documentation (click 'Wiki'), there is also a list of pins for the ATmega2560 that support PCINT.
The PCINT interrupts require some extra code, and the GreyGnome library adds a little extra code as well.
I started with an ATtiny13A and was at http://www.avrfreaks.net/, but I don't want to go back. I even changed the hardware of project to make it Arduino compatible, so I could burn a bootloader and use the Arduino IDE.
It is possible to add your own board definition to boards.txt, and add custom compiler options there as well, for example the -flto option :o
One of your links is to the manufacturer of the SRF10 : SRF10 Ultra sonic range finder
I suggest to use the Wire library for the SRF10. Is the "SR-010.ino" working ?
There is no repeated start in that code (see the links in my Reply #4).
To Wire.requestFrom() can be more straightforward:
Wire.requestFrom(115, 2); // request 2 bytes from slave device #112
if( Wire.available() == 2) // received the same amount as requested ?
{
reading = Wire.read(); // receive high byte (overwrites previous reading)
reading = reading << 8; // shift high byte to be high 8 bits
reading |= Wire.read(); // receive low byte as lower 8 bits
Serial.println(reading); // print the reading
}
else
{
Serial.println("bus error");
}
Or shorter:
int n = Wire.requestFrom(115, 2); // request 2 bytes from slave device #112
if( n == 2) // received the same amount as requested ?
{
reading = Wire.read(); // receive high byte (overwrites previous reading)
reading = reading << 8; // shift high byte to be high 8 bits
reading |= Wire.read(); // receive low byte as lower 8 bits
Serial.println(reading); // print the reading
}
else
{
Serial.println("bus error");
}
The Arduino has many things already defined : F_CPU, SDA, SCL, MOSI, and so on.
You can do this : pinMode( MOSI, OUTPUT);
The avr gcc library has also many things already defined, but you probably know that.
Do you still use that old motor shield. There is simplified code for it : Arduino Playground - AdafruitMotorShield
The SDA and SCL of the MPU-6050 may not be connected to the Arduino Mega 2560 !
You must use a I2C level shifter to create a 3.3V I2C bus.