Slide deck
Motorshield
Link for Motor Shield tutorial: https://learn.sparkfun.com/tutorials/tb6612fng-hookup-guide?_ga=2.227433246.2072068385.1551701674-349683115.1523944725
Download the library here: TB6612FNG ARDUINO LIBRARY, or grab the latest version from Sparkfun’s GitHub repository. Once the library is installed, open the example code included in the Library through the Arduino IDE’s examples.
Transistor/diode
You would use the same set up with a diode and transistor for a solenoid as well.
With Smaller Transistor (P2N2222A or a BC337):
With Tip120: