I was wondering whether I did it ok.
Yep, looks good. Some recommend wiring a simple diode (1N4001) directly across the motor terminals (cathode to positive terminal) to help prevent noise and spikes. For these small motors it's probably not as important as with the larger ones, but can't hurt and diodes are cheap.
Now with your software you have the option of using digital output commands to turn the motor on or off or using the analogWrite commands on the PWM pins to run the motor from off to 100% speed.