If you really want to make your own code to control the powered up motors Rasberry recently make the Pi Build hat which enabled you to control 4 motors using a rasberry pi. You can program them via their custom python library.
It was also on the robotics forum