RC522 light switch.

dear forum.

i hope some of you can help me.
im working in a light switch in my room using a RC522 rfid reader.
i want to scan my rfid tag to turn on/off my lights.
but right now it doesn’t really work.

i want to combine 2 script.

  1. unlock door with a rc522.
  2. a script to use a push button as a toggle switch.

i want to use the relay signal from the unlock door switch as the pushbutton signal to toggle the power on/off.

i included my script i hope someone can help me out on this.

joel pfeiffer
ps my english is not the best since im form holland.

light_switch.ino (21.2 KB)

joelpfeiffer: dear forum.

i hope some of you can help me. im working in a light switch in my room using a RC522 rfid reader. i want to scan my rfid tag to turn on/off my lights. but right now it doesn't really work.

"Doesn't really work" is not telling us how we can help. What does it do? What is it supposed to do?

It's not a "script", it's a sketch, code or program.

How i want it to work: scan my rfid, light turns on. Scan it again, lights turns off.

Whats happening now: scan my tag lights goes on. Scan it again, and knothing. The light doesnt turn off.