I have what should be a pretty simple question. I’m very new to this stuff. I’ve got a small DC motor. It runs just fine when connected to the arduino +5v and ground pins. I’d like to be able to simply switch it on and off, but I’m having difficulty figuring out how to do that. I first tried connecting it to various pins and a ground, and played around using digitalWrite() and analogWrite() in all kinds of different configurations, with no luck. So I tried putting a current I knew would work just fine with the motor through a transistor that was rated to handle it, and tried using the digital pins to control the base current, once again with no luck.
Are the methods I’ve tried flawed somehow, or do I just need to rework them? I’ve very recently opened an electronics text for the first time, so I’m sure there’s something very simple that I’m not getting here.
Thanks a bunch