Password using LDR

Hello!
I have thought about security device using LDR.

This is working principle of it.

1.It checks the resistance of LDR.
2.By using a resistance value, security device checks whether the light is on.(checking time interval: 1 seconds)
3.If the light is on > 1
If the light is off > 0 (usual)
4. loop this.
5. How to end the password: Automatically shut down when there isn't light for five seconds.
5. Get the password (ex: 10101, 100110)
6. export this password to computer.

Can anyone help with writing code?

Welcome in Arduino land,

You already know how the flow should go, that is good!

If you take one or two evenings to go through the tutorial section you will find all the code you need.
There are examples of LDR's analogRead() and Serial communication etc.

give it a try and if it doesn't work we will be glad to help you out.

Time spend in the tutorial section is not wasted!

Thank you for your kind answer. I’ll give it a try. :slight_smile: