Motor spins and diode gets hot. I believe I’ve connected it up according to the schematic and I’m running the example code. Using a 1000v 1amp diode that appears to be the correct way, stripe or cathode is connected to positive end of the motor terminal. Issue appears to be with switch control, using digital 2 and 9. Using switch makes no difference.
That’s not really the best picture.
Think the schematic itself may give a better indication but you may want to really double check the connections and the power source as running motors directly from an Arduino is not recommended.
Could you also review General guidance and how to use the forum as it will help you find your way around.
I can see, with some magnification that the grounds of the 9V battery powering the motor, through a breadboard, are connected together.
2 things, the breadboard does not have much current handling ability and the 9V batter is cow poop when it comes to any of these Arduino projects. Yup, no matter how many times they send the battery in kits or you see it on some demo, get rid of the 9V square battery.
And please post a proper schematic. Fritzthings are not proper schematics.
I believe you have used some IC in the circuit, Can you mention that. And although proper circuit diagram will help to understand it better. Moreover I believe some excessive energy supply is causing the issue