So for a project I’m doing in college we are making a robot that goes through a course and picks up paper clips and drops them off using an electromagnet. I’m using an Arduino RedBoard and external power to power my magnet. I have two breadboards on my robot one to operate the motors for the wheels and the other I’m planning to use for my magnet. I have no idea how to wire or program the magnet to power off when I need to using the external power source (9v battery) and the RedBoard. All operations through the course is autonomous.
So that sounds like you know how to do the motors and all the steering through the course. It's just the magnet that's a problem.
So show us the code you have so far that does all that good stuff. Then post details of your "electromagnet" so we know how to help.
Turning on and off power to an electromagnet is trivial.
Navigating a course autonomously is not.
What do you have working now?
You yelled in the title about needing help soon. What is the timeframe of your assignment?
You mention a 9v battery for power. If you are referring to a smoke detector battery, you will likely be disappointed in the very short run time. Be prepared to consider a better battery.
From what Steve said about me knowing how to run the motors I think I’ve figured out how to do what I need. Thank you Steve. I feel a little dumb for not realizing sooner bc the answer was so simple.