I need help with my code.
I want to create a alarm based on a LDR and a piezo.
It will start the alarm when there is light in the room.
But, i do not know how to set LDR up to be able to be used by the app to turn on and off,as in to turn off and on the LDR.
Pretty new to coding XD
What have you figured out for hardware yet? An LDR needs some sort of resistor, for starters. It may be more handy to use a PIR sensor. LDR’s are a bit troublesome to setup correct, as in, get good code for it. I’ve been at it for a couple months and it’s somewhat good enough for now, but you have to realize an LDR reading can differ.
I fixed it using three LDR’s, do about 6 readings with x-period in between and average it all out. It makes sense to normalize it a bit.