I've just bought an Arduino Uno kit, and am going through all the projects in the booklet that comes with the kit. From even the simplest LED and resistor circuit, to get a feel for the Arduino board, breadboarding, and to dust off my electronics knowledge that's been unused for some 30 years. It needs dusting off.
One of the circuits is simply to demo power switching using a motor and a NPN transistor. I understand every aspect of this most basic of cuicuits except for the function of a diode, that as far as I can tell, plays no role in the circuit's operation. It is surely there for a reason, so my question is: what is that reason?