I'am trying to operate a sheetmetal deforming machine with a arduino uno.The mecanial/hydraulic part of the machine is not the problem for me.But giving the arduino the right instructions that's new for me.I have studied a lot samples of codes and posts to learn to understand programming the arduino.The code of the blinking led with delay using a potmeter is a good start with for my application. I think?For my machine i use 2 potmeters, 1 proximity switch.1 Potmeter does the same like the blinking led sample.I changed the led for a relay, to oprate a hydraulic valve.So far so good.The machine i make is a simple big hammer operated with a hydraulic cilinder. Hammering metal sheet plates.If the hammer comes down and gives a hit directly afther that, it must go up. it may not rebound.Therefor i wil use a proxswitch to 'see' when de hammer is down.Potmeter 2 i will use is to adjust the rising time. (when to rise)Question, am i thinking in the right direction to create a code for this application???Any help for the code should be helpfull.By the way, this is a hobby project to rebuild a very old car.

Sounds like youre saying : : :Double acting cylinder and valve controled by ONE relay.Relay makes hammer go all the way UP in (which?) relay positionRelay makes hammer go all the way DOWN in other relay positionYou want hammer UP for X time, then DOWN to strike a piece, wait for Y time and them back UP ?You want the 2 potentiometers to adjust the timeUP and timeDOWN?You got a prox sensor to tell when hammer is DOWN?

If the hammer goes up, the relay is actuated.If the hammer goes down (freefall) the relay is not actuated.I want hammer UP for X time, then DOWN to strike a piece, wait for Y time and them back UP.One potmeter for the time up.The other potmeter for the wait' time to go up.And yes one prox sensor to see when the hammer is down.For start and stop function i can power up/power down.The hammer is always in the down position.

Rather than a proximity switch, if you could somehow isolate the tool end from the sheet metal, such that when the two contact each other, they form the "contacts" of a switch, that would be better than a separate switch. Note that there will likely be a form of resistance (because the metal you are working likely won't be shiny brand new, or may not be extremely conductive, or may be dirty, etc), so your actual switch would consist of the tool contact the metal, which would likely go into an op-amp or a comparator of some sort - and on the Arduino side in software (or external with hardware) you would want to debounce the switch.

Another possibility would be an optical sensor of some sort; or maybe something like a piezo "knock" sensor that could listen for the strike.

Lastly - will there be any safety considerations for this tool, or are you of the "pray not to lose fingers" school of metal work...?

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

A optical switch wil do.The idea of isolating the tool is a practical problem.Dónt worry about my fingers!!The reason that the hammer must lift upwards after the hit is to move the sheetmetal a little bit.