Simple example of Trinket M0 controlling a motor with a power MOSFET. The trinket M0 digital output can only source 7 mA. The motor in this example has a stall current of 500 mA so the trinket M0 can not drive the motor directly.
DIO pin 1 of the Trinket M0 is connected directly to the MOSFET gate.
The MOSFET source is connected to ground
A bench power supply is used to power the Motor/Drain circuit.
The positive terminal of the bench power supply will go to one terminal of the motor
The other terminal of the motor is connected to the MOSFET drain
A reversed biased diode wired across the motor terminals provides a short path for any negative voltage spikes from the motor.
The current limit on the power supply is set it 1 amp.
Warning: If the current limit is set too low the Tricket M0 will not be able to contend with the noise on the ground line and will have random resets causing reset issues, output glitches and USB enumeration issues.
USB from a computer will power the Trinket M0
A connection from the Trinket M0 / USB ground is connected to the bench power supply negative terminal in only one polace to avoid ground loops (the ground terminal on the power supply is left open). One should take care with the circuit layout to avoid inadvertent resets of the Trinket M0 board that would interfere with proper running of the program.
Trinket M0
Another page lists some significant links for the Trinket M0 and testing that was done in 2017: