need help with code for controlling a hydraulic press mode

MAS3:
Hi.

As the others tried to point out, it's important to use the correct names for the items you are using, or else the people trying to help you do not understand what you're talking about.
A microswitch looks like this:

(grabbed from tamiya website).
You are showing a relay, which is a completely different part.

Also, 50 volts AC is unsafe to connect to your Arduino.
The person at the shop you bought this stuff from, has built you a rectifier to make DC from the AC, using a diode and a capacitor.
Then he reduced the voltage by a huge (in size) 5 Watt, 6800 Ohm resistor and a zener diode.
Did he explain what this all does, and more important, do you understand that.
If not, what compels you to use this piece of hardware that you do not understand ?
In this case a relay would be a better choice, maybe with help of a resistor in case you can't find a 50 volts version.

first of all, thank you for your support. i think i should have mentioned that i don't hold a degree in electronics. i will accept any suggestion to change items that i use in order to achieve my goal.

now, as per the rectifier... i asked the guy to give me a relay for this, it was his idea for this and said that this is much simpler if i only need 5VDC to send to the arduino. i didn't connect this to the arduino yet since i had the breadboard and simulating input as i'm trying to get around with the code

EDIT: now i think i should have made some schematics and post pictures of the items and apologize for the lack of correct identifying of the items. sorry for that. but i think with the pictures i posted you can identify items and suggest replacement if needed :slight_smile: