Using 12V limit switch as input

Hello everyone
Not so good at electrical circuits, so I need help with 1 issue to complete my first project.

I have an external limit switch, that when pressed, will pass 12V. When not pressed, it passes 0V.

I would like Arduino to do something when the limits switch is pressed. I've tried a few different solutions but to no success.

My last attempt was to connect the 12V lines (Pos. & Neg. ) from the switch to a ACS758 board and the corresponding vcc, grn, output to Arduino. I got nothing of value on the Arduino analog pin... and the motor attached to the limit switch continued to run when the limit switch was pressed.... when prior, it stopped running as it was supposed too.


The ACS758 is a current sensor, how is that supposed to work?

Connect the limit switch to a voltage divider so you get 5V when the switch gives you 12V.

Connect that to a digital input and look at that input and stop the motor when you see it go high.

If you tried that and it didn’t work then post the schematic and the code you used.

How curious!

This exact question was asked just over three weeks ago!