In my railway project I use 12V in but only get 5V out max

0xff stops the motors.

Wire.write((speed >> 8)&0x80);

Needs to be

Wire.write((speed >> 8)&0x00);

for the second channel.