Arduino coding for a pulse of power

Okay so I am literally brand new to all of this but here's what I want to do...I am gonna use MobiFlight to write code for me for most of my needs as I'm building flight sim Hardware but on one of the pins I need the arduino Mega to PULSE a power signal for no longer than 5 to a very MAX of 7 seconds to a electromagnetic lock that I'm fabricating into a circuit breaker for flight sim. If it stays on longer than 7 seconds the magnet gets WAY too hot and will melt the plastic it will be in so when the Sims circuit breaker pops the sim sends a signal to that pin which will power the electromagnet for 5 to 7 seconds to release the breaker then power off? Can someone pls help me figure this out?

Also there will be other codes written to the mega so I need to know what goes where and how pretty pls...

A simple temperature switch were safer than a controller. It can be a heated bimetal switch, heated in parallel to the lock.

That would be introducing more pieces to a very small form factor puzzle I'm already having to use mosfet boards to make the 5 amps I need to pop the breakers

Very simple pseudo code in loop()

if (start) {
  delay(5000); //ON time
  while (start) ; //wait for start signal off

If you don't want blocking code.
Look in IDE Examples fpr "Blink without delay".

Tom... :smiley: :+1: :coffee: :australia:

Unfortunately tom I'm so new don't even know what you just said ide?


The IDE is the Integrated Development Environment, it is the editor you use to write your code.
This may help.

As you code you will find all sorts of things the IDE can do for you.

Tom.... :smiley: :+1: :coffee: :australia:

1 Like

As you anticipated I have banned you from the forum for 2 weeks. The folk here are trying to help you, if you don't like the particular help given you can be polite about declining it and move on. Swearing and abuse are absolutely not accepted here.

You are of course welcome back after your 2 week break if your posts remain polite and respectful.

Thank you.