Simple switch code, toggle on or off pin for 2 seconds

I am trying to use an arduino to interface between an Auto Transfer Switch and a Generator.

The ATS uses a 2 wire start. (Basically it shorts these together). However the generator uses a push button to start and stop the generator.

The Generator has an ATS port on it, but it is incompatible with the ATS switch.

Here is what I am looking to do.

Input on pin 10 (doesn't matter)
Output on pin 12 (doesn't matter)

When pin 10 gets pulled low (conected to GND) it pulls high pin 12 for 3 seconds then will start the generator.

When pin 10 gets disconnected from GND again pin 12 gets pulled high for 3 seconds, this will stop the generator.

Other than 10 getting pulled low or disconnected there should be no other times that pin 12 should get pulled high.

I am looking for some assistance on how to get started with coding this up.

Thanks

I’ve done this a hundred times..
You’ll get the code in no time.

Keep in mind fail-safe operation.
Pre start warning buzzer or strobe.

1 Like

Look at the builtin examples on the Arduino IDE.
Pick the "button" example.

Get it to work for you,just as written.
When that works, change it from pin 13 to your required output pin.
Change the button pin 2 to your selected pin #.
Wire it up and test. Easy!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.