4 button high activate lock.

Dear arduino users.

I am working on a locking mechanism that involves 4 different magnetic sensors to open a certain lock.
However I couldn't find any examples online but I know it would be super simple to code.

I don't know any of the coding language but I would love to have some help.

I am using a Arduino Leonardo R3 and the idea is to have: IF 4 sensors are high then unlock electromagnetic lock.
The Locks and sensors are all 12volts.

I saw a code for one button but not for 4.

Can someone help me out?
Greatly appreciate it.

Can you place the link for the sensors and lock?

Hi Daniel,

Have you gotten the single switch to work? If so, please post the code in a code block so we can review it.

(Use the </> button.)

Pat

danielpattiata:
I saw a code for one button but not for 4.

Can someone help me out?

const byte sensPin[]={4,5,6,7}; // define sensor pin numbers

if (digitalRead(sensPin[0]) && digitalRead(sensPin[1]) && digitalRead(sensPin[2]) && digitalRead(sensPin[3]) unlockDoor();

Hi Dan,

We're curious about the 12v sensors. I assume you're asking for advice on how to interface with them and on how to control your 12v lock.

Please post details so we can review them, thanks.

[edit] jurs' code will work for the digital logic portion of your sketch.

Pat

If you are using 12v sensor what is the logic level.
You can reply me on my ID

They do make arduino-comaptible boards built for 12v.

Simplest way to deal with a 12v input is with a resistor network:

Sensor +
       |
       W
       W 2k
       W
       |
       + ---- arduino
       |
       W
       W 1k
       W
       |
      --- ground